From: Thomas Fitzsimmons Date: Wed, 27 Mar 2013 19:56:10 +0000 (-0400) Subject: dbus/dbus-object-tree.c (_dbus_object_tree_unregister_and_unlock): Fix FIXME X-Git-Tag: dbus-1.8.2~146^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=52ca558efaffe7ae93b7dae387fd14d94b2823a3;p=platform%2Fupstream%2Fdbus.git dbus/dbus-object-tree.c (_dbus_object_tree_unregister_and_unlock): Fix FIXME Call unregister_and_free_path_recurse instead of find_subtree. Delete subtree removal logic since it has been refactored into unregister_subtree and attempt_child_removal. --- diff --git a/dbus/dbus-object-tree.c b/dbus/dbus-object-tree.c index 1c9b79d..9139b51 100644 --- a/dbus/dbus-object-tree.c +++ b/dbus/dbus-object-tree.c @@ -623,21 +623,27 @@ void _dbus_object_tree_unregister_and_unlock (DBusObjectTree *tree, const char **path) { - int i; - DBusObjectSubtree *subtree; + dbus_bool_t found_subtree; + dbus_bool_t continue_removal_attempts; DBusObjectPathUnregisterFunction unregister_function; void *user_data; DBusConnection *connection; + _dbus_assert (tree != NULL); _dbus_assert (path != NULL); + continue_removal_attempts = TRUE; unregister_function = NULL; user_data = NULL; - subtree = find_subtree (tree, path, &i); + found_subtree = unregister_and_free_path_recurse (tree->root, + path, + &continue_removal_attempts, + &unregister_function, + &user_data); #ifndef DBUS_DISABLE_CHECKS - if (subtree == NULL) + if (found_subtree == FALSE) { _dbus_warn ("Attempted to unregister path (path[0] = %s path[1] = %s) which isn't registered\n", path[0] ? path[0] : "null", @@ -645,39 +651,9 @@ _dbus_object_tree_unregister_and_unlock (DBusObjectTree *tree, goto unlock; } #else - _dbus_assert (subtree != NULL); + _dbus_assert (found_subtree == TRUE); #endif - _dbus_assert (subtree->parent == NULL || - (i >= 0 && subtree->parent->subtrees[i] == subtree)); - - subtree->message_function = NULL; - - unregister_function = subtree->unregister_function; - user_data = subtree->user_data; - - subtree->unregister_function = NULL; - subtree->user_data = NULL; - - /* If we have no subtrees of our own, remove from - * our parent (FIXME could also be more aggressive - * and remove our parent if it becomes empty) - */ - if (subtree->parent && subtree->n_subtrees == 0) - { - /* assumes a 0-byte memmove is OK */ - memmove (&subtree->parent->subtrees[i], - &subtree->parent->subtrees[i+1], - (subtree->parent->n_subtrees - i - 1) * - sizeof (subtree->parent->subtrees[0])); - subtree->parent->n_subtrees -= 1; - - subtree->parent = NULL; - - _dbus_object_subtree_unref (subtree); - } - subtree = NULL; - unlock: connection = tree->connection;