macos: ensure element is part of queue

We don't want to risk decrementing length field unless this is actually
part of the queue.
This commit is contained in:
Christian Hergert 2020-12-02 16:53:05 -08:00
parent e317b9be00
commit 92f0216605

View File

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