Re: [patch] subsurface: fix memory leak

"Henry (Yu) Song - SISA" <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <3955FA337689574EB32F94B12A7E6E9E16357293@SISAEX01SJ.sisa.samsung.com>
Hi, Chris

Is this OK for you?  Thanks

commit fb24f8eed4a71cd8612fc7252f71b0c0cf84e9bc
Author: Henry Song <[email protected]>
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 [[email protected]]
Sent: Thursday, June 14, 2012 2:46 PM
To: Henry (Yu) Song - SISA; [email protected]
Subject: RE: [cairo] [patch] subsurface: fix memory leak

On Thu, 14 Jun 2012 21:43:50 +0000, "Henry (Yu) Song - SISA" <[email protected]> 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
--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.