GtkApplication: Fix CRITICAL on shutdown when register_session=FALSE
authorJan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Wed, 5 Sep 2018 19:46:28 +0000 (21:46 +0200)
committerIain Lane <laney@debian.org>
Tue, 11 Sep 2018 16:33:38 +0000 (17:33 +0100)
Origin: upstream, commit:3c7d5e749ccafa75718ef00f1d5f6cdc0defacb3
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908070
Applied-Upstream: 3.24.1

Gbp-Pq: Name GtkApplication-Fix-CRITICAL-on-shutdown-when-register_ses.patch

gtk/gtkapplication-dbus.c

index 25015eb68cb32ed6656526a280973d4a234d9737..0946edf35cc51d03479788646e6cc0a8a329d8f1 100644 (file)
@@ -826,15 +826,22 @@ gtk_application_impl_dbus_finalize (GObject *object)
 {
   GtkApplicationImplDBus *dbus = (GtkApplicationImplDBus *) object;
 
-  g_dbus_connection_call (dbus->session,
-                          "org.freedesktop.portal.Desktop",
-                          dbus->session_id,
-                          "org.freedesktop.portal.Session",
-                          "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,
+                              "org.freedesktop.portal.Desktop",
+                              dbus->session_id,
+                              "org.freedesktop.portal.Session",
+                              "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);