2014/1/24 mathog <mathog@...1176...>:
> This line is completely equivalent to replacing it with a call
> cairo_save and adding a call to cairo_restore at the very end of the
> containing scope.
> You cannot move this line into a different function, because then the
> destructor (and hence cairo_restore) gets called when decorateItem()
Except my code ONLY works if it is moved into another function! That's what
is driving me nuts. I will have to trace this code thoroughly, as there
must be a dangling transformation or an extra cairo_restore or cairo_save
Please post a more complete listing of the good and the malfunctioning
version of your code. I'm sure we'll find the problem then. The "call,
line1, line2" etc. descriptions in your initial e-mail are a little
insufficient to figure out what is going on.
I guess. I am not a fan of implicit side effects unless there is
no way around it. Here
would have worked, and it would have been immediately apparent to a
maintenance programmer what was going on. Or is the ::Save stuff in there
to clean up in case there is an exception and the code jumps to a handler,
without ever returning from these functions?
You can add an early return and forget about adding the cleanup code,
there can be an exception, or you can simply forget about adding he
restore(). The ::Save object ensures proper cleanup in all of those