win32: free allocated gdi objects in 16bpp

In 16bpp, Gdk is creating hbitmap with CreateDIBSection() and a hdc with
CreateCompatibleDC(). Those 2 objects need to be released when the
pixmap is finalized.

https://bugzilla.gnome.org/show_bug.cgi?id=671538

Signed-off-by: Hans Breuer <hans@breuer.org>
This commit is contained in:
Marc-André Lureau
2013-04-08 22:45:50 +02:00
committed by Hans Breuer
parent 7ff6e601c3
commit 95985a2181
2 changed files with 7 additions and 0 deletions

View File

@@ -125,6 +125,11 @@ gdk_pixmap_impl_win32_finalize (GObject *object)
/* Drop our reference */
cairo_surface_destroy (drawable_impl->cairo_surface);
drawable_impl->cairo_surface = NULL;
if (impl->is_allocated)
{
GDI_CALL (DeleteDC, (drawable_impl->hdc));
GDI_CALL (DeleteObject, (GDK_PIXMAP_HBITMAP (wrapper)));
}
}
}
@@ -321,6 +326,7 @@ _gdk_pixmap_new (GdkDrawable *drawable,
}
SelectObject (hdc, hbitmap);
pixmap_impl->is_allocated = TRUE;
}
/* We need to use the same hdc, because only one hdc

View File

@@ -53,6 +53,7 @@ struct _GdkPixmapImplWin32
gint height;
guchar *bits;
guint is_foreign : 1;
guint is_allocated : 1;
};
struct _GdkPixmapImplWin32Class