Blame SOURCES/0037-local-display-factory-handle-reviving-displays-that-.patch

c90517
From 9c962b87b4e3d07b5ab2b212f0bcb662d7f4f7a2 Mon Sep 17 00:00:00 2001
c90517
From: Hans de Goede <hdegoede@redhat.com>
c90517
Date: Tue, 25 Sep 2018 14:39:42 -0400
c90517
Subject: [PATCH 37/48] local-display-factory: handle reviving displays that
c90517
 are waiting to die
c90517
c90517
We may end up re-using a display in waiting-to-finish state before it gets
c90517
finished in this case reset its state to managed to avoid it getting
c90517
finished while it is being used.
c90517
c90517
Closes https://gitlab.gnome.org/GNOME/gdm/merge_requests/45
c90517
---
c90517
 daemon/gdm-local-display-factory.c | 5 ++++-
c90517
 1 file changed, 4 insertions(+), 1 deletion(-)
c90517
c90517
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
c90517
index be7b43cff..d999596b5 100644
c90517
--- a/daemon/gdm-local-display-factory.c
c90517
+++ b/daemon/gdm-local-display-factory.c
c90517
@@ -434,61 +434,64 @@ create_display (GdmLocalDisplayFactory *factory,
c90517
                 const char             *seat_id,
c90517
                 const char             *session_type,
c90517
                 gboolean                initial)
c90517
 {
c90517
         GdmDisplayStore *store;
c90517
         GdmDisplay      *display = NULL;
c90517
         g_autofree char *login_session_id = NULL;
c90517
 
c90517
         g_debug ("GdmLocalDisplayFactory: %s login display for seat %s requested",
c90517
                  session_type? : "X11", seat_id);
c90517
         store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory));
c90517
 
c90517
         if (sd_seat_can_multi_session (seat_id))
c90517
                 display = gdm_display_store_find (store, lookup_prepared_display_by_seat_id, (gpointer) seat_id);
c90517
         else
c90517
                 display = gdm_display_store_find (store, lookup_by_seat_id, (gpointer) seat_id);
c90517
 
c90517
         /* Ensure we don't create the same display more than once */
c90517
         if (display != NULL) {
c90517
                 g_debug ("GdmLocalDisplayFactory: display already created");
c90517
                 return NULL;
c90517
         }
c90517
 
c90517
         /* If we already have a login window, switch to it */
c90517
         if (gdm_get_login_window_session_id (seat_id, &login_session_id)) {
c90517
                 GdmDisplay *display;
c90517
 
c90517
                 display = gdm_display_store_find (store,
c90517
                                                   lookup_by_session_id,
c90517
                                                   (gpointer) login_session_id);
c90517
-                if (display != NULL && gdm_display_get_status (display) == GDM_DISPLAY_MANAGED) {
c90517
+                if (display != NULL &&
c90517
+                    (gdm_display_get_status (display) == GDM_DISPLAY_MANAGED ||
c90517
+                     gdm_display_get_status (display) == GDM_DISPLAY_WAITING_TO_FINISH)) {
c90517
+                        g_object_set (G_OBJECT (display), "status", GDM_DISPLAY_MANAGED, NULL);
c90517
                         g_debug ("GdmLocalDisplayFactory: session %s found, activating.",
c90517
                                  login_session_id);
c90517
                         gdm_activate_session_by_id (factory->priv->connection, seat_id, login_session_id);
c90517
                         return NULL;
c90517
                 }
c90517
         }
c90517
 
c90517
         g_debug ("GdmLocalDisplayFactory: Adding display on seat %s", seat_id);
c90517
 
c90517
 #ifdef ENABLE_USER_DISPLAY_SERVER
c90517
         if (g_strcmp0 (seat_id, "seat0") == 0) {
c90517
                 display = gdm_local_display_new ();
c90517
                 if (session_type != NULL) {
c90517
                         g_object_set (G_OBJECT (display), "session-type", session_type, NULL);
c90517
                 }
c90517
         }
c90517
 #endif
c90517
 
c90517
         if (display == NULL) {
c90517
                 guint32 num;
c90517
 
c90517
                 num = take_next_display_number (factory);
c90517
 
c90517
                 display = gdm_legacy_display_new (num);
c90517
         }
c90517
 
c90517
         g_object_set (display, "seat-id", seat_id, NULL);
c90517
         g_object_set (display, "is-initial", initial, NULL);
c90517
 
c90517
         store_display (factory, display);
c90517
-- 
c90517
2.26.0
c90517