Merge lp:~ted/indicator-application/a-couple-race-fixups into lp:indicator-application/0.4

Proposed by Ted Gould
Status: Merged
Merged at revision: 166
Proposed branch: lp:~ted/indicator-application/a-couple-race-fixups
Merge into: lp:indicator-application/0.4
Diff against target: 48 lines (+24/-0)
1 file modified
src/app-indicator.c (+24/-0)
To merge this branch: bzr merge lp:~ted/indicator-application/a-couple-race-fixups
Reviewer Review Type Date Requested Status
Cody Russell (community) Approve
Review via email: mp+39669@code.launchpad.net

Description of the change

A fix for a possible race condition that I think is happening with startup where applications fallback and don't recover.

To post a comment you must log in.
Revision history for this message
Cody Russell (bratsche) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app-indicator.c'
2--- src/app-indicator.c 2010-09-21 19:22:16 +0000
3+++ src/app-indicator.c 2010-10-29 22:52:47 +0000
4@@ -32,6 +32,8 @@
5 #endif
6
7 #include <dbus/dbus-glib.h>
8+#include <dbus/dbus-glib-bindings.h>
9+
10 #include <libdbusmenu-glib/server.h>
11 #include <libdbusmenu-gtk/client.h>
12
13@@ -1052,6 +1054,23 @@
14 return;
15 }
16
17+/* Checking to see if someone already has the name we're looking for */
18+static void
19+check_owner_cb (DBusGProxy *proxy, gboolean exists, GError *error, gpointer userdata)
20+{
21+ if (error != NULL) {
22+ g_warning("Unable to check for '" NOTIFICATION_WATCHER_DBUS_ADDR "' on DBus. No worries, but concerning.");
23+ return;
24+ }
25+
26+ if (exists) {
27+ g_debug("Woah, we actually has a race condition with dbus");
28+ dbus_owner_change(proxy, NOTIFICATION_WATCHER_DBUS_ADDR, NULL, "Non NULL", userdata);
29+ }
30+
31+ return;
32+}
33+
34 /* This is an idle function to create the proxy. This is mostly
35 because start_fallback_timer can get called in the distruction
36 of a proxy and thus the proxy manager gets confused when creating
37@@ -1074,6 +1093,11 @@
38 G_TYPE_INVALID);
39 dbus_g_proxy_connect_signal(priv->dbus_proxy, "NameOwnerChanged",
40 G_CALLBACK(dbus_owner_change), data, NULL);
41+
42+ /* Check to see if anyone has the name we're looking for
43+ just incase we missed it changing. */
44+
45+ org_freedesktop_DBus_name_has_owner_async(priv->dbus_proxy, NOTIFICATION_WATCHER_DBUS_ADDR, check_owner_cb, data);
46 }
47
48 return FALSE;

Subscribers

People subscribed via source and target branches