From 92f0216605ca54e571f0af36a86ceedeb4bad3ec Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 2 Dec 2020 16:53:05 -0800 Subject: [PATCH] macos: ensure element is part of queue We don't want to risk decrementing length field unless this is actually part of the queue. --- gdk/macos/gdkmacosdisplay.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdk/macos/gdkmacosdisplay.c b/gdk/macos/gdkmacosdisplay.c index 37532fd079..be2d111c59 100644 --- a/gdk/macos/gdkmacosdisplay.c +++ b/gdk/macos/gdkmacosdisplay.c @@ -477,7 +477,8 @@ _gdk_macos_display_surface_removed (GdkMacosDisplay *self, if (self->keyboard_surface == surface) _gdk_macos_display_surface_resigned_key (self, surface); - g_queue_unlink (&self->sorted_surfaces, &surface->sorted); + if (queue_contains (&self->sorted_surfaces, &surface->sorted)) + g_queue_unlink (&self->sorted_surfaces, &surface->sorted); if (queue_contains (&self->main_surfaces, &surface->main)) _gdk_macos_display_surface_resigned_main (self, surface);