From: Hyotaek Shim Date: Thu, 1 Dec 2016 07:01:21 +0000 (-0800) Subject: Revert "kdbus: fix race-condition in GDBusNameWatching component" X-Git-Tag: accepted/tizen/common/20161212.185410~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F34%2F101434%2F1;p=platform%2Fupstream%2Fglib.git Revert "kdbus: fix race-condition in GDBusNameWatching component" This reverts commit f942d75a0ae909ef1f7419f093edb7826148a23d. Change-Id: Ic13b87efa9e8a73bf5e7a968fbfa4d9813071796 (cherry picked from commit d071aa0a622f39aeb066d468278f30c45070e016) --- diff --git a/gio/gdbusnamewatching.c b/gio/gdbusnamewatching.c index c35485a..07713db 100644 --- a/gio/gdbusnamewatching.c +++ b/gio/gdbusnamewatching.c @@ -322,23 +322,6 @@ on_name_owner_changed (GDBusConnection *connection, /* ---------------------------------------------------------------------------------------------------- */ static void -handle_new_name_owner (Client *client, - const gchar *name_owner) -{ - if (name_owner != NULL) - { - g_warn_if_fail (client->name_owner == NULL); - client->name_owner = name_owner; - call_appeared_handler (client); - } - else - { - call_vanished_handler (client, FALSE); - } - client->initialized = TRUE; -} - -static void get_name_owner_cb (GObject *source_object, GAsyncResult *res, gpointer user_data) @@ -358,7 +341,18 @@ get_name_owner_cb (GObject *source_object, g_variant_get (result, "(&s)", &name_owner); } - handle_new_name_owner (client, g_strdup (name_owner)); + if (name_owner != NULL) + { + g_warn_if_fail (client->name_owner == NULL); + client->name_owner = g_strdup (name_owner); + call_appeared_handler (client); + } + else + { + call_vanished_handler (client, FALSE); + } + + client->initialized = TRUE; if (result != NULL) g_variant_unref (result); @@ -478,22 +472,8 @@ has_connection (Client *client) } else { - /* check owner - to avoid race-condition between GetNameOwner reply and - NameOwnerChanged signal let's use GetNameOwner sync call on kdbus bus */ - if (_g_dbus_connection_is_kdbus (client->connection)) - { - gchar *name_owner; - - name_owner = g_dbus_get_name_owner (client->connection, - client->name, - NULL); - - handle_new_name_owner (client, name_owner); - } - else - { - invoke_get_name_owner (client); - } + /* check owner */ + invoke_get_name_owner (client); } }