summaryrefslogtreecommitdiff
path: root/extra/xfce4-settings/xfce4-settings-4.10.0-check-service-name-of-nameownerchanged.patch
blob: 1d271476e091045e55c59ff4584b2abeb3d5a7d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From 2ec636049b95d0c51286253813b5b1a074472afc Mon Sep 17 00:00:00 2001
From: Lionel Le Folgoc <lionel@lefolgoc.net>
Date: Sun, 09 Sep 2012 09:50:19 +0000
Subject: 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)
---
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;
--
cgit v0.9.0.3