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

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