Blame SOURCES/0006-manager-gracefully-handle-the-case-of-no-session-for.patch

a1b388
From 454a3daad5148a8ef30cb298af82aa0713e73af7 Mon Sep 17 00:00:00 2001
a1b388
From: Lubomir Rintel <lkundrak@v3.sk>
a1b388
Date: Mon, 18 Jun 2018 12:33:51 +0200
a1b388
Subject: [PATCH 06/51] manager: gracefully handle the case of no session for
a1b388
 login window
a1b388
a1b388
get_login_window_session_id() will return TRUE with session_id=NULL when
a1b388
there's no session. This restults in an assertion failure on
a1b388
constructing the o.fd.login1.Manager.ActivateSessionOnSeat() arguments:
a1b388
a1b388
  GLib: g_variant_new_string: assertion 'string != NULL' failed
a1b388
---
a1b388
 daemon/gdm-manager.c | 6 ++++--
a1b388
 1 file changed, 4 insertions(+), 2 deletions(-)
a1b388
a1b388
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
a1b388
index 71f55ec65..7a5554e9d 100644
a1b388
--- a/daemon/gdm-manager.c
a1b388
+++ b/daemon/gdm-manager.c
a1b388
@@ -1448,62 +1448,64 @@ get_login_window_session_id (const char  *seat_id,
a1b388
                 }
a1b388
 
a1b388
                 free (service_id);
a1b388
         }
a1b388
 
a1b388
         *session_id = NULL;
a1b388
         ret = FALSE;
a1b388
 
a1b388
 out:
a1b388
         if (sessions) {
a1b388
                 for (i = 0; sessions[i]; i ++) {
a1b388
                         free (sessions[i]);
a1b388
                 }
a1b388
 
a1b388
                 free (sessions);
a1b388
         }
a1b388
 
a1b388
         return ret;
a1b388
 }
a1b388
 
a1b388
 static void
a1b388
 activate_login_window_session_on_seat (GdmManager *self,
a1b388
                                        const char *seat_id)
a1b388
 {
a1b388
         char *session_id;
a1b388
 
a1b388
         if (!get_login_window_session_id (seat_id, &session_id)) {
a1b388
                 return;
a1b388
         }
a1b388
 
a1b388
-        activate_session_id (self, seat_id, session_id);
a1b388
-        g_free (session_id);
a1b388
+        if (session_id) {
a1b388
+                activate_session_id (self, seat_id, session_id);
a1b388
+                g_free (session_id);
a1b388
+        }
a1b388
 }
a1b388
 
a1b388
 static void
a1b388
 maybe_activate_other_session (GdmManager *self,
a1b388
                               GdmDisplay *old_display)
a1b388
 {
a1b388
         char *seat_id = NULL;
a1b388
         char *session_id;
a1b388
         int ret;
a1b388
 
a1b388
         g_object_get (G_OBJECT (old_display),
a1b388
                       "seat-id", &seat_id,
a1b388
                       NULL);
a1b388
 
a1b388
         ret = sd_seat_get_active (seat_id, &session_id, NULL);
a1b388
 
a1b388
         if (ret == 0) {
a1b388
                 GdmDisplay *display;
a1b388
 
a1b388
                 display = gdm_display_store_find (self->priv->display_store,
a1b388
                                                   lookup_by_session_id,
a1b388
                                                   (gpointer) session_id);
a1b388
 
a1b388
                 if (display == NULL) {
a1b388
                         activate_login_window_session_on_seat (self, seat_id);
a1b388
                 }
a1b388
         }
a1b388
 
a1b388
         g_free (seat_id);
a1b388
 }
a1b388
-- 
a1b388
2.27.0
a1b388