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

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