[gtk/wip/chergert/gdk-macos-for-master: 9/11] macos: ensure element is part of queue




commit 92f0216605ca54e571f0af36a86ceedeb4bad3ec
Author: Christian Hergert <chergert redhat com>
Date:   Wed Dec 2 16:53:05 2020 -0800

    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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]