[glib] GApplication: Don't call dbus_unregister multiple times



commit df06dc65501100606ca027d4e85aa5a240305be2
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Jun 8 20:15:46 2017 +0200

    GApplication: Don't call dbus_unregister multiple times
    
    https://bugzilla.gnome.org/show_bug.cgi?id=725950

 gio/gapplicationimpl-dbus.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gio/gapplicationimpl-dbus.c b/gio/gapplicationimpl-dbus.c
index 1cef317..ac029a9 100644
--- a/gio/gapplicationimpl-dbus.c
+++ b/gio/gapplicationimpl-dbus.c
@@ -120,6 +120,7 @@ struct _GApplicationImpl
   gboolean         properties_live;
   gboolean         primary;
   gboolean         busy;
+  gboolean         registered;
   GApplication    *app;
 };
 
@@ -403,6 +404,7 @@ g_application_impl_attempt_primary (GApplicationImpl  *impl,
   if (impl->actions_id == 0)
     return FALSE;
 
+  impl->registered = TRUE;
   if (!app_class->dbus_register (impl->app,
                                  impl->session_bus,
                                  impl->object_path,
@@ -455,9 +457,13 @@ g_application_impl_stop_primary (GApplicationImpl *impl)
 {
   GApplicationClass *app_class = G_APPLICATION_GET_CLASS (impl->app);
 
-  app_class->dbus_unregister (impl->app,
-                              impl->session_bus,
-                              impl->object_path);
+  if (impl->registered)
+    {
+      app_class->dbus_unregister (impl->app,
+                                  impl->session_bus,
+                                  impl->object_path);
+      impl->registered = FALSE;
+    }
 
   if (impl->object_id)
     {


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