[cairo] Huge leak in Cairo/win32

Owen Taylor otaylor at redhat.com
Sun Feb 20 18:46:17 PST 2005


Hans Breuer wrote:
> While playing with gtk/win32's Cairo integration I spotted
> a huge leak also visible with cairo_snippets_win32. To see
> it simply go through the snippets with key 'n' or 'p' and
> watch the memory usage with the task manager.
> 
> To plug it apply the attached patch :-)
> 
> The leak was caused by missing 'unselect' of the cairo/win32
> internal surface->bitmap. Failing to do so lets the following
> DeleteObject(bitmap) call fail as well.
> Also in case of a self-created dc that needs to be deleted, too.

Stupid question - can't we just delete the DC first rather
than after the bitmap? won't that automatically unselect the bitmap
and let us delete it afterwards?

> BTW: cairo-win32.h looks like it got commited with win32
> line endings from unix. Getting it back with win32 cvs
> gives 0x0d 0x0d 0x0a. Difficult to patch but can this be
> fixed as well?

Not easy to diff, but easy to fix. Done.

Thanks,
					Owen




More information about the cairo mailing list