[cairo] Leak in win32 display surface

Chris Wilson chris at chris-wilson.co.uk
Fri Feb 15 06:08:28 PST 2013

On Fri, Feb 15, 2013 at 02:58:28PM +0100, Zozó Teki wrote:
> Hi,
> I noticed that a win32 surface does not destroy its fallback image.

Thanks for the bug report.

commit fb1abbc4bc25c541cfb1084012a6a185c541c340
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Feb 15 14:04:21 2013 +0000

    win32: Free the fallback upon finish
> Creating a win32 display surface, doing something that creates the fallback and
> deleting the win32 surface will leak the fallback surface.
> In the below patch (against 1.12.14) I do 2 things. 
> 1. In _cairo_win32_display_surface_finish I add code to destroy the fallback
> image.
> 2. In _cairo_win32_display_surface_flush I modify the code to destroy the
> fallback image even if there was damage made to it (of course only after
> flushing the damage).

The point of not detaching the fallback in this case is to provide a
little bit of hystersis to reduce ping-pong migration. i.e. if we were
actively using the fallback, we are likely to again in the next
operation and if we were to destroy it we would have to read back the
whole surface again before commencing the fallback.

Chris Wilson, Intel Open Source Technology Centre

More information about the cairo mailing list