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
This commit is contained in:
Carlos Garnacho 2019-08-15 13:59:01 +02:00
parent 3259c7e150
commit a0bdf44c2d

View File

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