[gtk/wip/chergert/macos-fixes: 14/15] macos: cleanup window surface when destroying context
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/macos-fixes: 14/15] macos: cleanup window surface when destroying context
- Date: Thu, 3 Feb 2022 21:37:06 +0000 (UTC)
commit 9cf1a41a4329b74cab3ff2ed1781d80a2eac6cc8
Author: Christian Hergert <christian hergert me>
Date: Thu Feb 3 13:28:56 2022 -0800
macos: cleanup window surface when destroying context
Make sure we release the cairo_surface_t for the window when
disposing the GdkMacosCairoContext.
gdk/macos/gdkmacoscairocontext.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
---
diff --git a/gdk/macos/gdkmacoscairocontext.c b/gdk/macos/gdkmacoscairocontext.c
index 73ba7cffa0..2b9a91c16f 100644
--- a/gdk/macos/gdkmacoscairocontext.c
+++ b/gdk/macos/gdkmacoscairocontext.c
@@ -141,12 +141,25 @@ _gdk_macos_cairo_context_surface_resized (GdkDrawContext *draw_context)
g_clear_pointer (&self->window_surface, cairo_surface_destroy);
}
+static void
+_gdk_macos_cairo_context_dispose (GObject *object)
+{
+ GdkMacosCairoContext *self = (GdkMacosCairoContext *)object;
+
+ g_clear_pointer (&self->window_surface, cairo_surface_destroy);
+
+ G_OBJECT_CLASS (_gdk_macos_cairo_context_parent_class)->dispose (object);
+}
+
static void
_gdk_macos_cairo_context_class_init (GdkMacosCairoContextClass *klass)
{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkCairoContextClass *cairo_context_class = GDK_CAIRO_CONTEXT_CLASS (klass);
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass);
+ object_class->dispose = _gdk_macos_cairo_context_dispose;
+
draw_context_class->begin_frame = _gdk_macos_cairo_context_begin_frame;
draw_context_class->end_frame = _gdk_macos_cairo_context_end_frame;
draw_context_class->surface_resized = _gdk_macos_cairo_context_surface_resized;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]