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
This commit is contained in:
Carlos Garnacho 2020-09-21 12:02:46 +02:00
parent d504086ebf
commit 1b39b92fa5

View File

@ -169,11 +169,13 @@ apply_allow_commits_x11_property (MetaWindowXwayland *xwayland_window,
MetaWindow *window = META_WINDOW (xwayland_window); MetaWindow *window = META_WINDOW (xwayland_window);
MetaDisplay *display = window->display; MetaDisplay *display = window->display;
MetaX11Display *x11_display = display->x11_display; MetaX11Display *x11_display = display->x11_display;
Display *xdisplay = x11_display->xdisplay;
MetaFrame *frame; MetaFrame *frame;
Window xwin; Window xwin;
guint32 property[1]; guint32 property[1];
if (!x11_display)
return;
frame = meta_window_get_frame (window); frame = meta_window_get_frame (window);
if (!frame) if (!frame)
xwin = window->xwindow; xwin = window->xwindow;
@ -186,12 +188,12 @@ apply_allow_commits_x11_property (MetaWindowXwayland *xwayland_window,
property[0] = !!allow_commits; property[0] = !!allow_commits;
meta_x11_error_trap_push (x11_display); meta_x11_error_trap_push (x11_display);
XChangeProperty (xdisplay, xwin, XChangeProperty (x11_display->xdisplay, xwin,
x11_display->atom__XWAYLAND_ALLOW_COMMITS, x11_display->atom__XWAYLAND_ALLOW_COMMITS,
XA_CARDINAL, 32, PropModeReplace, XA_CARDINAL, 32, PropModeReplace,
(guchar*) &property, 1); (guchar*) &property, 1);
meta_x11_error_trap_pop (x11_display); meta_x11_error_trap_pop (x11_display);
XFlush (xdisplay); XFlush (x11_display->xdisplay);
} }
static void static void