From: Jan Alexander Steffens (heftig) Date: Wed, 5 Sep 2018 19:46:28 +0000 (+0200) Subject: GtkApplication: Fix CRITICAL on shutdown when register_session=FALSE X-Git-Tag: archive/raspbian/3.24.39-1+rpi1~1^2~65^2~31^2~20^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3c7d5e7;p=gtk%2B3.0.git GtkApplication: Fix CRITICAL on shutdown when register_session=FALSE --- diff --git a/gtk/gtkapplication-dbus.c b/gtk/gtkapplication-dbus.c index 25015eb68c..0946edf35c 100644 --- a/gtk/gtkapplication-dbus.c +++ b/gtk/gtkapplication-dbus.c @@ -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);