[cairo-bugs] [Bug 63787] Assertion failure in cairo under windows when using GIMP's new canvas rotation

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sun Apr 21 23:34:37 PDT 2013


--- Comment #1 from Uli Schlachter <psychon at znc.in> ---
Someone should paint a picture about this, the reference magic makes my head

At the cairo_restore() at the end of gimp_display_shell_render(), the current
source of the gc is a surface pattern. In the rotated case, this pattern holds
the only reference to the surface "xfer" which is a similar image to
cairo_get_target(cr) (a win32 surface). Behind the covers, this image surface
has a reference to a win32_display_surface (its parent).

Now when the pattern is destroyed, the reference count to the similar image
drops to zero (This seems correct, although the behind-the-scenes reference
loop with the win32_display_surface still confuses me). While finishing this
image surface, it drops the reference to its parent. Thus, now the
win32_display_surface gets finished, too. In
_cairo_win32_display_surface_finish(), this one now tries to get rid of the
similar image again, although this one is already being finished some stack
frames above. And *boom*, assert() notices that something went foobar.

Whoever maintains cairo-win32 can come up with a good solution. Since these
reference loops make my head hurt, I can only suggest to make
_cairo_image_surface_finish() set ->parent to NULL before destroying its parent
and then in _cairo_win32_display_surface_finish() check if the image surface's
parent is still set before destroying the image. However, this hack smells
quite fishy to me.

You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo-bugs/attachments/20130422/79f27988/attachment.html>

More information about the cairo-bugs mailing list