[mutter] xwayland: Handle the died callback being cancelled more gracefully



commit 29141afd0fbc97ba6f981f5df6fa731558dcd13f
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Thu Oct 28 15:33:03 2021 +0200

    xwayland: Handle the died callback being cancelled more gracefully
    
    If we were cancelled, it could mean we teared down, meaning fetching
    manager instances will attempt to fetch past freed instances. Handle
    this by waiting with the fetching until we know we weren't cancelled.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2140>

 src/wayland/meta-xwayland.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 54bb614b01..c6421a4305 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -536,14 +536,12 @@ xserver_died (GObject      *source,
               GAsyncResult *result,
               gpointer      user_data)
 {
-  MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
+  MetaWaylandCompositor *compositor;
   GSubprocess *proc = G_SUBPROCESS (source);
   MetaDisplay *display = meta_get_display ();
   g_autoptr (GError) error = NULL;
   MetaX11DisplayPolicy x11_display_policy;
 
-  x11_display_policy =
-    meta_context_get_x11_display_policy (compositor->context);
   if (!g_subprocess_wait_finish (proc, result, &error))
     {
       if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
@@ -551,7 +549,11 @@ xserver_died (GObject      *source,
 
       g_warning ("Failed to finish waiting for Xwayland: %s", error->message);
     }
-  else if (!g_subprocess_get_successful (proc))
+
+  compositor = meta_wayland_compositor_get_default ();
+  x11_display_policy =
+    meta_context_get_x11_display_policy (compositor->context);
+  if (!g_subprocess_get_successful (proc))
     {
       if (x11_display_policy == META_X11_DISPLAY_POLICY_MANDATORY)
         g_warning ("X Wayland crashed; exiting");


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