Re: goocanvasmm: problem on accessing cairo matrix

Many thanks Murray.

As you suspected pMatrix is null until translate() is invoked, when it is becomes initialized. Presumably, the other transform methods would initialize it similarly though I haven't tested this yet.
I find this strange but no longer a problem.


Murray Cumming wrote:
On Mon, 2009-07-13 at 18:28 +0100, David Davies wrote:
void ExampleWindow::update_label()
    cairo_matrix_t * pMatrix = m_text->property_transform(); // line A
    double x0 = pMatrix->x0; // line B

    std::stringstream str;

My aim is to output the components of the transform matrix so that I
can understand what is happening to it.
The program compiles and links in CDT with no reported error.

If I comment out line B, it runs OK and, as expected, gives the same output as the original example.
With line B however, the program terminates and outputs a
<terminated> message without opening a window.
It does not report an error.

You really need to use a debugger. I suspect that pMatrix is null. You
should check pointers for null before dereferencing them anyway.

I don't know _why_ it is null. Maybe that's a normal value, if there is
no "transformation matrix" set for the item, though I don't quite know
when that would be set.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]