If proxy->priv->name is a well-known name (what just means that we
created proxy for well-known name) then proxy->priv->name_owner points
to current name owner (unique id or NULL if name currently doesn't have
any owner). If we have following scenario:
1) server termination
2) g_dbus_proxy_call() to server
2a) get_destination_for_call()
3) on_name_owner callback, which set proxy->priv->name_owner to NULL
then get_destination_for_call() function will return
proxy->priv->name_owner value (which is unique id of previous name
owner). To avoid above race condition it will be better if we 'always'
return well-known name (without checking name_owner value).
Change-Id: I31f7edb56d8434e26a15efe260c1b737486da93e
static const gchar *
get_destination_for_call (GDBusProxy *proxy)
{
- const gchar *ret;
-
- ret = NULL;
-
- /* If proxy->priv->name is a unique name, then proxy->priv->name_owner
- * is never NULL and always the same as proxy->priv->name. We use this
- * knowledge to avoid checking if proxy->priv->name is a unique or
- * well-known name.
- */
- ret = proxy->priv->name_owner;
- if (ret != NULL)
- goto out;
-
if (proxy->priv->flags & G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START)
- goto out;
-
- ret = proxy->priv->name;
+ return proxy->priv->name_owner;
- out:
- return ret;
+ return proxy->priv->name;
}
/* ---------------------------------------------------------------------------------------------------- */