Blame SOURCES/0001-display-Handle-failure-before-display-registration.patch

9cc5e2
From cbfb3ef99ecc9cbb4e6850e5dd0cc9fb65dd398a Mon Sep 17 00:00:00 2001
a1b388
From: Ray Strode <rstrode@redhat.com>
a1b388
Date: Tue, 1 Sep 2020 13:49:27 -0400
9cc5e2
Subject: [PATCH 1/3] display: Handle failure before display registration
a1b388
a1b388
Normally, e.g., gdm-wayland-session would register its display
a1b388
before starting the session.  This display registration is how
a1b388
the display moves to the "managed" state.  We currently detect
a1b388
session failure in gdm_display_unmanage. If gdm-wayland-session
a1b388
is killed before it registers the display, gdm_display_unmanage
a1b388
won't run, and failure won't be detected.
a1b388
a1b388
This commit make gdm_display_unmanage get called, even if the
a1b388
display isn't yet fully managed.
a1b388
---
a1b388
 daemon/gdm-display.c | 8 +++-----
a1b388
 1 file changed, 3 insertions(+), 5 deletions(-)
a1b388
a1b388
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
9cc5e2
index 7c954ad24..3a260923a 100644
a1b388
--- a/daemon/gdm-display.c
a1b388
+++ b/daemon/gdm-display.c
9cc5e2
@@ -648,62 +648,60 @@ gdm_display_disconnect (GdmDisplay *self)
a1b388
 
a1b388
         /* resource_id_mask is the bits given to each client for
a1b388
          * addressing resources */
a1b388
         highest_client = (XID) ~unused_bits & ~setup->resource_id_mask;
a1b388
         client_increment = setup->resource_id_mask + 1;
a1b388
 
a1b388
         /* Kill every client but ourselves, then close our own connection
a1b388
          */
a1b388
         for (client = 0;
a1b388
              client <= highest_client;
a1b388
              client += client_increment) {
a1b388
 
a1b388
                 if (client != setup->resource_id_base)
9cc5e2
                         xcb_kill_client (priv->xcb_connection, client);
a1b388
         }
a1b388
 
9cc5e2
         xcb_flush (priv->xcb_connection);
a1b388
 
9cc5e2
         g_clear_pointer (&priv->xcb_connection, xcb_disconnect);
a1b388
 }
a1b388
 
a1b388
 gboolean
a1b388
 gdm_display_unmanage (GdmDisplay *self)
a1b388
 {
9cc5e2
         GdmDisplayPrivate *priv;
9cc5e2
 
a1b388
         g_return_val_if_fail (GDM_IS_DISPLAY (self), FALSE);
a1b388
 
9cc5e2
         priv = gdm_display_get_instance_private (self);
9cc5e2
 
a1b388
-        g_debug ("GdmDisplay: unmanage display");
a1b388
-
a1b388
         gdm_display_disconnect (self);
a1b388
 
9cc5e2
         if (priv->user_access_file != NULL) {
9cc5e2
                 gdm_display_access_file_close (priv->user_access_file);
9cc5e2
                 g_object_unref (priv->user_access_file);
9cc5e2
                 priv->user_access_file = NULL;
a1b388
         }
a1b388
 
9cc5e2
         if (priv->access_file != NULL) {
9cc5e2
                 gdm_display_access_file_close (priv->access_file);
9cc5e2
                 g_object_unref (priv->access_file);
9cc5e2
                 priv->access_file = NULL;
a1b388
         }
a1b388
 
9cc5e2
         if (!priv->session_registered) {
a1b388
                 g_warning ("GdmDisplay: Session never registered, failing");
a1b388
                 _gdm_display_set_status (self, GDM_DISPLAY_FAILED);
a1b388
         } else {
a1b388
                 _gdm_display_set_status (self, GDM_DISPLAY_UNMANAGED);
a1b388
         }
a1b388
 
a1b388
         return TRUE;
a1b388
 }
a1b388
 
a1b388
 gboolean
a1b388
 gdm_display_get_id (GdmDisplay         *self,
a1b388
                     char              **id,
a1b388
                     GError            **error)
a1b388
 {
9cc5e2
         GdmDisplayPrivate *priv;
9cc5e2
@@ -1446,63 +1444,63 @@ gdm_display_get_object_skeleton (GdmDisplay *self)
a1b388
 {
9cc5e2
         GdmDisplayPrivate *priv;
a1b388
 
9cc5e2
         priv = gdm_display_get_instance_private (self);
9cc5e2
         return priv->object_skeleton;
a1b388
 }
a1b388
 
a1b388
 static void
a1b388
 on_launch_environment_session_opened (GdmLaunchEnvironment *launch_environment,
a1b388
                                       GdmDisplay           *self)
a1b388
 {
a1b388
         char       *session_id;
a1b388
 
a1b388
         g_debug ("GdmDisplay: Greeter session opened");
a1b388
         session_id = gdm_launch_environment_get_session_id (launch_environment);
a1b388
         _gdm_display_set_session_id (self, session_id);
a1b388
         g_free (session_id);
a1b388
 }
a1b388
 
a1b388
 static void
a1b388
 on_launch_environment_session_started (GdmLaunchEnvironment *launch_environment,
a1b388
                                        GdmDisplay           *self)
a1b388
 {
a1b388
         g_debug ("GdmDisplay: Greeter started");
a1b388
 }
a1b388
 
a1b388
 static void
a1b388
 self_destruct (GdmDisplay *self)
a1b388
 {
a1b388
         g_object_ref (self);
a1b388
-        if (gdm_display_get_status (self) == GDM_DISPLAY_MANAGED) {
a1b388
-                gdm_display_unmanage (self);
a1b388
-        }
9cc5e2
+
a1b388
+        g_debug ("GdmDisplay: initiating display self-destruct");
a1b388
+        gdm_display_unmanage (self);
a1b388
 
a1b388
         if (gdm_display_get_status (self) != GDM_DISPLAY_FINISHED) {
a1b388
                 queue_finish (self);
a1b388
         }
a1b388
         g_object_unref (self);
a1b388
 }
a1b388
 
a1b388
 static void
a1b388
 on_launch_environment_session_stopped (GdmLaunchEnvironment *launch_environment,
a1b388
                                        GdmDisplay           *self)
a1b388
 {
a1b388
         g_debug ("GdmDisplay: Greeter stopped");
a1b388
         self_destruct (self);
a1b388
 }
a1b388
 
a1b388
 static void
a1b388
 on_launch_environment_session_exited (GdmLaunchEnvironment *launch_environment,
a1b388
                                       int                   code,
a1b388
                                       GdmDisplay           *self)
a1b388
 {
a1b388
         g_debug ("GdmDisplay: Greeter exited: %d", code);
a1b388
         self_destruct (self);
a1b388
 }
a1b388
 
a1b388
 static void
a1b388
 on_launch_environment_session_died (GdmLaunchEnvironment *launch_environment,
a1b388
                                     int                   signal,
a1b388
                                     GdmDisplay           *self)
a1b388
 {
a1b388
         g_debug ("GdmDisplay: Greeter died: %d", signal);
a1b388
-- 
9cc5e2
2.31.1
a1b388