[Xfce4-commits] <xfce4-settings:xfce-4.10> Xfsettingsd: Check service name of NameOwnerChanged (bug #9273).

Nick Schermer noreply at xfce.org
Sun Sep 9 11:54:02 CEST 2012


Updating branch refs/heads/xfce-4.10
         to 2ec636049b95d0c51286253813b5b1a074472afc (commit)
       from 8032dd77047329a93edd4c4a8b686ffc36d2f7a7 (commit)

commit 2ec636049b95d0c51286253813b5b1a074472afc
Author: Lionel Le Folgoc <lionel at lefolgoc.net>
Date:   Sun Sep 9 11:50:19 2012 +0200

    Xfsettingsd: Check service name of NameOwnerChanged (bug #9273).
    
    In some conditions, the dbus spawn of xfconf leads to the
    shutdown of xfsettingsd because it "thinks" another instance
    is taking over... After some debugging I found that it
    receives a NameOwnerChanged signal describing the launch
    of Xfconf (name=org.xfce.Xfconf, old=, new=:1.11 for example).
    
    (cherry picked from commit c17fe35e6f2ff673bab102e736a327fa7bcc1d73)

 xfsettingsd/main.c |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/xfsettingsd/main.c b/xfsettingsd/main.c
index 0f3a68d..55c4183 100644
--- a/xfsettingsd/main.c
+++ b/xfsettingsd/main.c
@@ -93,15 +93,29 @@ signal_handler (gint signum,
 
 
 static DBusHandlerResult
-dbus_connection_filter_func (DBusConnection     *connection,
-                             DBusMessage        *message,
-                             void               *user_data)
+dbus_connection_filter_func (DBusConnection *connection,
+                             DBusMessage    *message,
+                             void           *user_data)
 {
+    gchar *name, *old, *new;
+
     if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged"))
     {
-        g_printerr (G_LOG_DOMAIN ": %s\n", "Another instance took over. Leaving...");
-        gtk_main_quit ();
-        return DBUS_HANDLER_RESULT_HANDLED;
+        /* double check if it is really org.xfce.SettingsDaemon
+         * being replaced, see bug 9273 */
+        if (dbus_message_get_args (message, NULL,
+                                   DBUS_TYPE_STRING, &name,
+                                   DBUS_TYPE_STRING, &old,
+                                   DBUS_TYPE_STRING, &new,
+                                   DBUS_TYPE_INVALID))
+        {
+            if (g_strcmp0 (name, XFSETTINGS_DBUS_NAME) == 0)
+            {
+                g_printerr (G_LOG_DOMAIN ": %s\n", "Another instance took over. Leaving...");
+                gtk_main_quit ();
+                return DBUS_HANDLER_RESULT_HANDLED;
+            }
+        }
     }
 
     return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;


More information about the Xfce4-commits mailing list