Re: [patch] subsurface: fix memory leak
"Henry (Yu) Song - SISA" <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <3955FA337689574EB32F94B12A7E6E9E1635724B@SISAEX01SJ.sisa.samsung.com> |
Hi, Chris How about this commit 43fef9e03a453eecaf6fd5a83674de8928fc0d73 Author: Henry Song <[email protected]> Date: Thu Jun 14 14:24:35 2012 -0700 gl: we do not set snapshot of a subsurface, this causes a memory leak. Instead, we roll our own dice diff --git a/src/cairo-gl-operand.c b/src/cairo-gl-operand.c index 4ef3307..d723e07 100644 --- a/src/cairo-gl-operand.c +++ b/src/cairo-gl-operand.c @@ -157,7 +157,9 @@ _cairo_gl_subsurface_clone_operand_init (cairo_gl_operand_t *operand, return status; } - _cairo_surface_subsurface_set_snapshot (&sub->base, &surface->base); + if (sub->snapshot) + cairo_surface_detach_snapshot (sub->snapshot); + sub->snapshot = cairo_surface_reference (&surface->base); } status = _resolve_multisampling (surface); ________________________________________ From: Chris Wilson [[email protected]] Sent: Thursday, June 14, 2012 2:18 PM To: Henry (Yu) Song - SISA; [email protected] Subject: RE: [cairo] [patch] subsurface: fix memory leak On Thu, 14 Jun 2012 20:57:19 +0000, "Henry (Yu) Song - SISA" <[email protected]> wrote: > Hi, Chris > > Better idea to break cyclic referencing? As it stands, the only option is not to use the subsurface snapshot cache. The challenge is to remove the requirement of surfaces having to hold a reference to its snapshots. I think that could be done by moving the reference into the callers as required. -Chris -- Chris Wilson, Intel Open Source Technology Centre -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo