[cairo] [patch] subsurface: fix memory leak

Henry (Yu) Song - SISA hsong at sisa.samsung.com
Thu Jun 14 14:57:24 PDT 2012


Hi, Chris

Is this OK for you?  Thanks

commit fb24f8eed4a71cd8612fc7252f71b0c0cf84e9bc
Author: Henry Song <henry.song at samsung.com>
Date:   Thu Jun 14 14:51:22 2012 -0700

    subsurface: _cairo_surface_subsurface_set_snapshot () sets the subsurface
    as the snapshot of its target.  This creates a cyclic referencing and thus
    a memory leak.  Test case: subsurface-similar-repeat.  We 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..4c904d0 100644
--- a/src/cairo-surface-subsurface.c
+++ b/src/cairo-surface-subsurface.c
@@ -557,6 +557,11 @@ _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: attach the subsurface as a snapshot to its target creates
+       a cyclic referencing.  Let's make this call as a no-op until
+       bug is fixed.
+     */
+    /*
     if (ss->snapshot)
 	_cairo_surface_detach_snapshot (ss->snapshot);
 
@@ -564,4 +569,5 @@ _cairo_surface_subsurface_set_snapshot (cairo_surface_t *surface,
 
     _cairo_surface_attach_snapshot (ss->target, &ss->base,
 				    _cairo_surface_subsurface_detach_snapshot);
+    */
 }


________________________________________
From: Chris Wilson [chris at chris-wilson.co.uk]
Sent: Thursday, June 14, 2012 2:46 PM
To: Henry (Yu) Song - SISA; cairo at cairographics.org
Subject: RE: [cairo] [patch] subsurface: fix memory leak

On Thu, 14 Jun 2012 21:43:50 +0000, "Henry (Yu) Song - SISA" <hsong at sisa.samsung.com> wrote:
> Hi, Chris
>
> OK, I am reluctant to do this, but that is the only option?

Replace it with a comment instead about what you want to do...

I think the better solution is to actually make
_cairo_surface_subsurface_set_snapshot() a no-op and explain the
reference-cycle that needs to be fixed before we can re-enable it.
-Chris

--
Chris Wilson, Intel Open Source Technology Centre


More information about the cairo mailing list