1 |
From c17fe35e6f2ff673bab102e736a327fa7bcc1d73 Mon Sep 17 00:00:00 2001 |
2 |
From: Lionel Le Folgoc <lionel@lefolgoc.net> |
3 |
Date: Sun, 09 Sep 2012 09:50:19 +0000 |
4 |
Subject: Xfsettingsd: Check service name of NameOwnerChanged (bug #9273). |
5 |
|
6 |
In some conditions, the dbus spawn of xfconf leads to the |
7 |
shutdown of xfsettingsd because it "thinks" another instance |
8 |
is taking over... After some debugging I found that it |
9 |
receives a NameOwnerChanged signal describing the launch |
10 |
of Xfconf (name=org.xfce.Xfconf, old=, new=:1.11 for example). |
11 |
--- |
12 |
diff --git a/xfsettingsd/main.c b/xfsettingsd/main.c |
13 |
index 0f3a68d..55c4183 100644 |
14 |
--- a/xfsettingsd/main.c |
15 |
+++ b/xfsettingsd/main.c |
16 |
@@ -93,15 +93,29 @@ signal_handler (gint signum, |
17 |
|
18 |
|
19 |
static DBusHandlerResult |
20 |
-dbus_connection_filter_func (DBusConnection *connection, |
21 |
- DBusMessage *message, |
22 |
- void *user_data) |
23 |
+dbus_connection_filter_func (DBusConnection *connection, |
24 |
+ DBusMessage *message, |
25 |
+ void *user_data) |
26 |
{ |
27 |
+ gchar *name, *old, *new; |
28 |
+ |
29 |
if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) |
30 |
{ |
31 |
- g_printerr (G_LOG_DOMAIN ": %s\n", "Another instance took over. Leaving..."); |
32 |
- gtk_main_quit (); |
33 |
- return DBUS_HANDLER_RESULT_HANDLED; |
34 |
+ /* double check if it is really org.xfce.SettingsDaemon |
35 |
+ * being replaced, see bug 9273 */ |
36 |
+ if (dbus_message_get_args (message, NULL, |
37 |
+ DBUS_TYPE_STRING, &name, |
38 |
+ DBUS_TYPE_STRING, &old, |
39 |
+ DBUS_TYPE_STRING, &new, |
40 |
+ DBUS_TYPE_INVALID)) |
41 |
+ { |
42 |
+ if (g_strcmp0 (name, XFSETTINGS_DBUS_NAME) == 0) |
43 |
+ { |
44 |
+ g_printerr (G_LOG_DOMAIN ": %s\n", "Another instance took over. Leaving..."); |
45 |
+ gtk_main_quit (); |
46 |
+ return DBUS_HANDLER_RESULT_HANDLED; |
47 |
+ } |
48 |
+ } |
49 |
} |
50 |
|
51 |
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; |
52 |
-- |
53 |
cgit v0.9.0.3 |