summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2008-11-17 23:30:32 (GMT)
committerColin Walters <walters@verbum.org>2008-11-17 23:30:32 (GMT)
commit3ca014ea6b55cd843f1c80b04a4e0ec41af6210e (patch)
treeba50eef74dc9c839cb3f502245ac5c7ca32e9745
parent0a883a523f8d133f71271276b755162c56480021 (diff)
downloaddbus-glib-3ca014ea6b55cd843f1c80b04a4e0ec41af6210e.tar.gz
dbus-glib-3ca014ea6b55cd843f1c80b04a4e0ec41af6210e.tar.xz
Bug 18573 - Fix race when service appears and disappears quickly
We can't assert that a for_name_owner proxy is associated when we disassociate; if a service appears and disappears quickly, we won't be associated yet. So remove the assertion. Correspondingly we need to cancel any inflight GetNameOwner call when disassociating proxies to avoid leaking.
-rw-r--r--dbus/dbus-gproxy.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/dbus/dbus-gproxy.c b/dbus/dbus-gproxy.c
index 36d55f8..949a0a0 100644
--- a/dbus/dbus-gproxy.c
+++ b/dbus/dbus-gproxy.c
@@ -658,8 +658,15 @@ unassociate_proxies (gpointer key, gpointer val, gpointer user_data)
{
if (!priv->for_owner)
{
- g_assert (priv->associated);
- g_assert (priv->name_call == NULL);
+ /* If a service appeared and then vanished very quickly,
+ * it's conceivable we have an inflight request for
+ * GetNameOwner here. Cancel it.
+ * https://bugs.freedesktop.org/show_bug.cgi?id=18573
+ */
+ if (priv->name_call)
+ dbus_g_proxy_cancel_call (manager->bus_proxy, priv->name_call);
+
+ priv->name_call = NULL;
priv->associated = FALSE;
manager->unassociated_proxies = g_slist_prepend (manager->unassociated_proxies, proxy);