From 8a4fd3f2aff9b61f977a7ff927a924a254babb8b Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Mon, 31 Jan 2022 13:02:58 -0800 Subject: [PATCH] macos: check for destroyed surfaces in vfuncs --- gdk/macos/gdkmacossurface.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gdk/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c index a6a354cab7..19a4453212 100644 --- a/gdk/macos/gdkmacossurface.c +++ b/gdk/macos/gdkmacossurface.c @@ -190,6 +190,9 @@ gdk_macos_surface_end_frame (GdkMacosSurface *self) g_assert (GDK_IS_MACOS_SURFACE (self)); + if (GDK_SURFACE_DESTROYED (self)) + return; + display = gdk_surface_get_display (GDK_SURFACE (self)); frame_clock = gdk_surface_get_frame_clock (GDK_SURFACE (self)); @@ -208,10 +211,11 @@ gdk_macos_surface_before_paint (GdkMacosSurface *self, g_assert (GDK_IS_MACOS_SURFACE (self)); g_assert (GDK_IS_FRAME_CLOCK (frame_clock)); - if (surface->update_freeze_count > 0) + if (GDK_SURFACE_DESTROYED (self)) return; - gdk_macos_surface_begin_frame (self); + if (surface->update_freeze_count == 0) + gdk_macos_surface_begin_frame (self); } static void @@ -223,10 +227,11 @@ gdk_macos_surface_after_paint (GdkMacosSurface *self, g_assert (GDK_IS_MACOS_SURFACE (self)); g_assert (GDK_IS_FRAME_CLOCK (frame_clock)); - if (surface->update_freeze_count > 0) + if (GDK_SURFACE_DESTROYED (self)) return; - gdk_macos_surface_end_frame (self); + if (surface->update_freeze_count == 0) + gdk_macos_surface_end_frame (self); } static void