[cairo-commit] src/cairo-surface-subsurface.c

Chris Wilson ickle at kemper.freedesktop.org
Thu Jun 14 15:17:17 PDT 2012

 src/cairo-surface-subsurface.c |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit 9bc1ea44316d448110c1d128a9f74147f775943d
Author: Henry Song <henry.song at samsung.com>
Date:   Thu Jun 14 23:07:34 2012 +0100

    subsurface: Disable subsurface-set-snapshot as it creates a ref cycle
    _cairo_surface_subsurface_set_snapshot () sets the subsurface as the
    snapshot of its target.  This creates a reference cycle (as the target
    is already referenced by the surface) and thus a memory leak (assuming
    the likely case that user doesn't call finish).
    Test case: subsurface-similar-repeat.
    So make this call as a no-op for the time being until the bug is fixed.

diff --git a/src/cairo-surface-subsurface.c b/src/cairo-surface-subsurface.c
index 90440c7..7ceef11 100644
--- a/src/cairo-surface-subsurface.c
+++ b/src/cairo-surface-subsurface.c
@@ -557,6 +557,12 @@ _cairo_surface_subsurface_set_snapshot (cairo_surface_t *surface,
     TRACE ((stderr, "%s: target=%d, snapshot=%d\n", __FUNCTION__,
 	    ss->target->unique_id, snapshot->unique_id));
+    /* FIXME: attaching the subsurface as a snapshot to its target creates
+     * a reference cycle.  Let's make this call as a no-op until that bug
+     * is fixed.
+     */
+    return;
     if (ss->snapshot)
 	_cairo_surface_detach_snapshot (ss->snapshot);

More information about the cairo-commit mailing list