[mutter/wip/carlosg/xwayland-non-fatal-io-errors: 146/147] xwayland: Protect against MetaX11Display abruptly closing




commit 14430affe3cede1cf7d590b68e4b33110dc455bb
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Sep 21 12:02:46 2020 +0200

    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 0c77ca5d72..cb4b667aa0 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]