From a0bdf44c2d0c0875a074715a0419dc1eaad19b0c Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Thu, 15 Aug 2019 13:59:01 +0200 Subject: [PATCH] core: Do not crash on untimely stack queries for X11 windows Some meta_later operations may happen across XWayland being shutdown, that trigger MetaStackTracker queries for X11 XIDs. This crashes as the MetaX11Display is already NULL. Return a NULL window in that case, as in "unknown stack ID". https://gitlab.gnome.org/GNOME/mutter/merge_requests/728 --- src/core/display.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core/display.c b/src/core/display.c index fb4b127f5..3d1e33429 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -1426,10 +1426,16 @@ meta_display_lookup_stack_id (MetaDisplay *display, guint64 stack_id) { if (META_STACK_ID_IS_X11 (stack_id)) - return meta_x11_display_lookup_x_window (display->x11_display, - (Window)stack_id); + { + if (!display->x11_display) + return NULL; + return meta_x11_display_lookup_x_window (display->x11_display, + (Window)stack_id); + } else - return meta_display_lookup_stamp (display, stack_id); + { + return meta_display_lookup_stamp (display, stack_id); + } } /* We return a pointer into a ring of static buffers. This is to make