[cairo] Uncollectable ref cycle in cairo-meta-surface
Chris Wilson
chris at chris-wilson.co.uk
Thu Sep 13 00:42:48 PDT 2007
For some time I've been tracking down a reference leak on an error path
within self-copy. After spending a lot of time eyeballing the code, I
dug out my old refdbg valgrind skin which very quickly showed me that I
wasting my time! The issue at hand is that the self-copy test requires
the explicit cairo_surface_finish() within the boilerplate code in order
for the reference cycle to be broken. IMHO, the user is never warned
about this possibility and believes one can solely rely on
cairo_surface_destroy() to correctly call cairo_surface_finish().
AIUI we can either change the API to force the user to mark surfaces as
finished after they have completed their drawing operations and enforce
it with a check in cairo_surface_destroy() or we avoid ref cycles within
cairo. The attached patch demonstrates the latter.
--
Chris Wilson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: refcycle.patch
Type: text/x-diff
Size: 3525 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20070913/ec7212b4/attachment.patch
More information about the cairo
mailing list