dbus/dbus-object-tree.c: Add test case for parent removal fix
authorThomas Fitzsimmons <fitzsim@cisco.com>
Wed, 27 Mar 2013 20:14:16 +0000 (16:14 -0400)
committerThomas Fitzsimmons <fitzsim@cisco.com>
Wed, 27 Mar 2013 20:14:16 +0000 (16:14 -0400)
dbus/dbus-object-tree.c

index 95d5234..14061e8 100644 (file)
@@ -1685,6 +1685,7 @@ object_tree_test_iteration (void *data)
   const char *path6[] = { "blah", "boof", NULL };
   const char *path7[] = { "blah", "boof", "this", "is", "really", "long", NULL };
   const char *path8[] = { "childless", NULL };
+  DBusObjectPathVTable test_vtable = { NULL, test_message_function, NULL };
   DBusObjectTree *tree;
   TreeTestData tree_test_data[9];
   int i;
@@ -2112,6 +2113,20 @@ object_tree_test_iteration (void *data)
   _dbus_assert (!find_subtree_registered_or_unregistered (tree, path2));
   _dbus_assert (find_subtree_registered_or_unregistered (tree, path0));
 
+  /* Test with NULL unregister_function and user_data */
+  if (!_dbus_object_tree_register (tree, TRUE, path2,
+                                   &test_vtable,
+                                   NULL,
+                                   NULL))
+    goto out;
+
+  _dbus_assert (_dbus_object_tree_get_user_data_unlocked (tree, path2) == NULL);
+  _dbus_object_tree_unregister_and_unlock (tree, path2);
+  _dbus_assert (!find_subtree (tree, path2, NULL));
+  _dbus_assert (!find_subtree_registered_or_unregistered (tree, path2));
+  _dbus_assert (!find_subtree_registered_or_unregistered (tree, path1));
+  _dbus_assert (find_subtree_registered_or_unregistered (tree, path0));
+
   /* Register it all again, and test dispatch */
   
   if (!do_register (tree, path0, TRUE, 0, tree_test_data))