From 1b39b92fa599f51046dbb5b2e26ff9fb907e13af Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Mon, 21 Sep 2020 12:02:46 +0200 Subject: [PATCH] xwayland: Protect against MetaX11Display abruptly closing If the MetaX11Display abruptly closed when X11 windows were present, we would still try to deal with them while freezing/thawing for the "fade out" animation. At the bottom of that, the X server may be gone, just try to cope with it. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1447 --- src/wayland/meta-window-xwayland.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/wayland/meta-window-xwayland.c b/src/wayland/meta-window-xwayland.c index 0c77ca5d7..cb4b667aa 100644 --- a/src/wayland/meta-window-xwayland.c +++ b/src/wayland/meta-window-xwayland.c @@ -169,11 +169,13 @@ apply_allow_commits_x11_property (MetaWindowXwayland *xwayland_window, MetaWindow *window = META_WINDOW (xwayland_window); MetaDisplay *display = window->display; MetaX11Display *x11_display = display->x11_display; - Display *xdisplay = x11_display->xdisplay; MetaFrame *frame; Window xwin; guint32 property[1]; + if (!x11_display) + return; + frame = meta_window_get_frame (window); if (!frame) xwin = window->xwindow; @@ -186,12 +188,12 @@ apply_allow_commits_x11_property (MetaWindowXwayland *xwayland_window, property[0] = !!allow_commits; meta_x11_error_trap_push (x11_display); - XChangeProperty (xdisplay, xwin, + XChangeProperty (x11_display->xdisplay, xwin, x11_display->atom__XWAYLAND_ALLOW_COMMITS, XA_CARDINAL, 32, PropModeReplace, (guchar*) &property, 1); meta_x11_error_trap_pop (x11_display); - XFlush (xdisplay); + XFlush (x11_display->xdisplay); } static void