[gtk] GtkApplication: Fix CRITICAL on shutdown when register_session=FALSE



commit d90e2733eaaba7db79c518e98ad1acc0f8e6d216
Author: Jan Alexander Steffens (heftig) <jan steffens gmail com>
Date:   Wed Sep 5 21:46:28 2018 +0200

    GtkApplication: Fix CRITICAL on shutdown when register_session=FALSE
    
    Close https://gitlab.gnome.org/GNOME/gtk/issues/1323#note_327705

 gtk/gtkapplication-dbus.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkapplication-dbus.c b/gtk/gtkapplication-dbus.c
index 409f5f570f..f089e06483 100644
--- a/gtk/gtkapplication-dbus.c
+++ b/gtk/gtkapplication-dbus.c
@@ -788,15 +788,22 @@ gtk_application_impl_dbus_finalize (GObject *object)
 {
   GtkApplicationImplDBus *dbus = (GtkApplicationImplDBus *) object;
 
-  g_dbus_connection_call (dbus->session,
-                          PORTAL_BUS_NAME,
-                          dbus->session_id,
-                          PORTAL_SESSION_INTERFACE,
-                          "Close",
-                          NULL, NULL, 0, -1, NULL, NULL, NULL);
-
-  g_free (dbus->session_id);
-  g_dbus_connection_signal_unsubscribe (dbus->session, dbus->state_changed_handler);
+  if (dbus->session_id)
+    {
+      g_dbus_connection_call (dbus->session,
+                              PORTAL_BUS_NAME,
+                              dbus->session_id,
+                              PORTAL_SESSION_INTERFACE,
+                              "Close",
+                              NULL, NULL, 0, -1, NULL, NULL, NULL);
+
+      g_free (dbus->session_id);
+    }
+
+  if (dbus->state_changed_handler)
+    g_dbus_connection_signal_unsubscribe (dbus->session,
+                                          dbus->state_changed_handler);
+
   g_clear_object (&dbus->inhibit_proxy);
   g_slist_free_full (dbus->inhibit_handles, inhibit_handle_free);
   g_free (dbus->app_menu_path);


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