[gdm/wip/gdm-vt-switch-fixes: 5/6] local-display-factory: Remove same VT so don't switch check



commit 4176921462866d80ea0ca8eceea9e1dfd06217ae
Author: Ray Strode <rstrode redhat com>
Date:   Tue Sep 25 14:30:16 2018 -0400

    local-display-factory: Remove same VT so don't switch check
    
    We avoid changing to the login screen vt if we're already on it,
    but the call is racy since we react to vt changes concurrently
    with logind (who we query for the active vt).
    
    This check drops the active vt check since it's pointless and
    getting in the way.

 daemon/gdm-local-display-factory.c | 39 +++++++++++++-------------------------
 1 file changed, 13 insertions(+), 26 deletions(-)
---
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
index be4bac0a..244a3201 100644
--- a/daemon/gdm-local-display-factory.c
+++ b/daemon/gdm-local-display-factory.c
@@ -432,8 +432,7 @@ create_display (GdmLocalDisplayFactory *factory,
 {
         GdmDisplayStore *store;
         GdmDisplay      *display = NULL;
-        char            *active_session_id = NULL;
-        int              ret;
+        g_autofree char *login_session_id = NULL;
 
         g_debug ("GdmLocalDisplayFactory: %s login display for seat %s requested",
                  session_type? : "X11", seat_id);
@@ -450,31 +449,19 @@ create_display (GdmLocalDisplayFactory *factory,
                 return NULL;
         }
 
-        ret = sd_seat_get_active (seat_id, &active_session_id, NULL);
-
-        if (ret == 0) {
-                char *login_session_id = NULL;
-
-                /* If we already have a login window, switch to it */
-                if (gdm_get_login_window_session_id (seat_id, &login_session_id)) {
-                        GdmDisplay *display;
-
-                        display = gdm_display_store_find (store,
-                                                          lookup_by_session_id,
-                                                          (gpointer) login_session_id);
-                        if (display != NULL && gdm_display_get_status (display) == GDM_DISPLAY_MANAGED) {
-                                if (g_strcmp0 (active_session_id, login_session_id) != 0) {
-                                        g_debug ("GdmLocalDisplayFactory: session %s found, activating.",
-                                                 login_session_id);
-                                        gdm_activate_session_by_id (factory->priv->connection, seat_id, 
login_session_id);
-                                }
-                                g_clear_pointer (&login_session_id, g_free);
-                                g_clear_pointer (&active_session_id, g_free);
-                                return NULL;
-                        }
-                        g_clear_pointer (&login_session_id, g_free);
+        /* If we already have a login window, switch to it */
+        if (gdm_get_login_window_session_id (seat_id, &login_session_id)) {
+                GdmDisplay *display;
+
+                display = gdm_display_store_find (store,
+                                                  lookup_by_session_id,
+                                                  (gpointer) login_session_id);
+                if (display != NULL && gdm_display_get_status (display) == GDM_DISPLAY_MANAGED) {
+                        g_debug ("GdmLocalDisplayFactory: session %s found, activating.",
+                                 login_session_id);
+                        gdm_activate_session_by_id (factory->priv->connection, seat_id, login_session_id);
+                        return NULL;
                 }
-                g_clear_pointer (&active_session_id, g_free);
         }
 
         g_debug ("GdmLocalDisplayFactory: Adding display on seat %s", seat_id);


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