← Back to team overview

ayatana-commits team mailing list archive

[Branch ~dbusmenu-team/dbusmenu/trunk] Rev 114: Do an extra check for the name to fix some Hudson tests.

 

Merge authors:
  Ted Gould (ted)
------------------------------------------------------------
revno: 114 [merge]
committer: Ted Gould <ted@xxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-06-10 21:22:01 -0500
message:
  Do an extra check for the name to fix some Hudson tests.
modified:
  libdbusmenu-glib/client.c


--
lp:dbusmenu
https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk

Your team ayatana-commits is subscribed to branch lp:dbusmenu.
To unsubscribe from this branch go to https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk/+edit-subscription
=== modified file 'libdbusmenu-glib/client.c'
--- libdbusmenu-glib/client.c	2010-05-09 15:12:51 +0000
+++ libdbusmenu-glib/client.c	2010-06-11 02:11:45 +0000
@@ -30,6 +30,8 @@
 #include "config.h"
 #endif
 
+#include <dbus/dbus-glib-bindings.h>
+
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 
@@ -397,6 +399,25 @@
 	return build_proxies(client);
 }
 
+/* This is the response to see if the name has an owner.  If
+   it does, then we should build the proxies here.  Race condition
+   check. */
+static void
+name_owner_check (DBusGProxy *proxy, gboolean has_owner, GError *error, gpointer userdata)
+{
+	if (error != NULL) {
+		return;
+	}
+
+	if (!has_owner) {
+		return;
+	}
+
+	DbusmenuClient * client = DBUSMENU_CLIENT(userdata);
+	build_proxies(client);
+	return;
+}
+
 /* This function builds the DBus proxy which will look out for
    the service coming up. */
 static void
@@ -426,6 +447,13 @@
 	dbus_g_proxy_connect_signal(priv->dbusproxy, "NameOwnerChanged",
 	                            G_CALLBACK(dbus_owner_change), client, NULL);
 
+	/* Now let's check to make sure we're not in some race
+	   condition case. */
+	org_freedesktop_DBus_name_has_owner_async(priv->dbusproxy,
+	                                          priv->dbus_name,
+	                                          name_owner_check,
+	                                          client);
+
 	return;
 }