mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-03 17:21:11 +00:00
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. https://bugzilla.gnome.org/show_bug.cgi?id=685959
This commit is contained in:
parent
85bb1a161c
commit
bb867e9406
@ -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",
|
||||
GDK_PIXMAP_HBITMAP (wrapper)));
|
||||
|
||||
if (!impl->is_foreign)
|
||||
GDK_DRAWABLE_IMPL_WIN32 (impl)->hdc_count--;
|
||||
{
|
||||
drawable_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));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user