Commit bb867e94 authored by Alexander Larsson's avatar Alexander Larsson
Browse files

win32: Don't leak the pixmap cairo_surface

GdkPixmapWin32 allocates a cairo_surface manually for non-foreign
pixmaps, instead of letting GdkDrawableWin32 create on on-demand.
However, the pixmap created surface is a strong ref, rather than the
weak ref created by gdk_win32_ref_cairo_surface() so we can't rely
on _gdk_win32_drawable_finish to actually free it. So, we have to
manually free it when we finalize or we leak it.
parent 85bb1a16
......@@ -105,13 +105,23 @@ static void
gdk_pixmap_impl_win32_finalize (GObject *object)
GdkPixmapImplWin32 *impl = GDK_PIXMAP_IMPL_WIN32 (object);
GdkPixmap *wrapper = GDK_PIXMAP (GDK_DRAWABLE_IMPL_WIN32 (impl)->wrapper);
GdkDrawableImplWin32 *drawable_impl = GDK_DRAWABLE_IMPL_WIN32 (impl);
GdkPixmap *wrapper = GDK_PIXMAP (drawable_impl->wrapper);
GDK_NOTE (PIXMAP, g_print ("gdk_pixmap_impl_win32_finalize: %p\n",
if (!impl->is_foreign)
GDK_DRAWABLE_IMPL_WIN32 (impl)->hdc_count--;
/* Tell outstanding owners that the surface is useless */
cairo_surface_finish (drawable_impl->cairo_surface);
/* Drop our reference */
cairo_surface_destroy (drawable_impl->cairo_surface);
drawable_impl->cairo_surface = NULL;
_gdk_win32_drawable_finish (GDK_DRAWABLE (object));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment