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

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