mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
GDBus: Fix bug in child enumeration
Signed-off-by: David Zeuthen <davidz@redhat.com>
This commit is contained in:
parent
93bf09a9e7
commit
51ed44e7ad
@ -3712,7 +3712,7 @@ introspect_append_standard_interfaces (GString *s)
|
||||
static void
|
||||
maybe_add_path (const gchar *path, gsize path_len, const gchar *object_path, GHashTable *set)
|
||||
{
|
||||
if (g_str_has_prefix (object_path, path) && strlen (object_path) > path_len)
|
||||
if (g_str_has_prefix (object_path, path) && strlen (object_path) > path_len && object_path[path_len-1] == '/')
|
||||
{
|
||||
const gchar *begin;
|
||||
const gchar *end;
|
||||
@ -3720,7 +3720,6 @@ maybe_add_path (const gchar *path, gsize path_len, const gchar *object_path, GHa
|
||||
|
||||
begin = object_path + path_len;
|
||||
end = strchr (begin, '/');
|
||||
|
||||
if (end != NULL)
|
||||
s = g_strndup (begin, end - begin);
|
||||
else
|
||||
|
@ -963,6 +963,7 @@ test_object_registration (void)
|
||||
guint boss_foo_reg_id;
|
||||
guint boss_bar_reg_id;
|
||||
guint worker1_foo_reg_id;
|
||||
guint worker1p1_foo_reg_id;
|
||||
guint worker2_bar_reg_id;
|
||||
guint intern1_foo_reg_id;
|
||||
guint intern2_bar_reg_id;
|
||||
@ -1022,6 +1023,18 @@ test_object_registration (void)
|
||||
worker1_foo_reg_id = registration_id;
|
||||
num_successful_registrations++;
|
||||
|
||||
registration_id = g_dbus_connection_register_object (c,
|
||||
"/foo/boss/worker1p1",
|
||||
&foo_interface_info,
|
||||
NULL,
|
||||
&data,
|
||||
on_object_unregistered,
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (registration_id > 0);
|
||||
worker1p1_foo_reg_id = registration_id;
|
||||
num_successful_registrations++;
|
||||
|
||||
registration_id = g_dbus_connection_register_object (c,
|
||||
"/foo/boss/worker2",
|
||||
&bar_interface_info,
|
||||
@ -1250,8 +1263,9 @@ test_object_registration (void)
|
||||
|
||||
nodes = get_nodes_at (c, "/foo/boss");
|
||||
g_assert (nodes != NULL);
|
||||
g_assert_cmpint (g_strv_length (nodes), ==, 4);
|
||||
g_assert_cmpint (g_strv_length (nodes), ==, 5);
|
||||
g_assert (_g_strv_has_string ((const gchar* const *) nodes, "worker1"));
|
||||
g_assert (_g_strv_has_string ((const gchar* const *) nodes, "worker1p1"));
|
||||
g_assert (_g_strv_has_string ((const gchar* const *) nodes, "worker2"));
|
||||
g_assert (_g_strv_has_string ((const gchar* const *) nodes, "interns"));
|
||||
g_assert (_g_strv_has_string ((const gchar* const *) nodes, "executives"));
|
||||
@ -1311,6 +1325,17 @@ test_object_registration (void)
|
||||
g_assert (_g_strv_has_string ((const gchar* const *) nodes, "evp2"));
|
||||
g_strfreev (nodes);
|
||||
|
||||
/* This is to check that a bug (rather, class of bugs) in gdbusconnection.c's
|
||||
*
|
||||
* g_dbus_connection_list_registered_unlocked()
|
||||
*
|
||||
* where /foo/boss/worker1 reported a child '1', is now fixed.
|
||||
*/
|
||||
nodes = get_nodes_at (c, "/foo/boss/worker1");
|
||||
g_assert (nodes != NULL);
|
||||
g_assert_cmpint (g_strv_length (nodes), ==, 0);
|
||||
g_strfreev (nodes);
|
||||
|
||||
/* check that calls are properly dispatched to the functions in foo_vtable for objects
|
||||
* implementing the org.example.Foo interface
|
||||
*
|
||||
@ -1339,6 +1364,7 @@ test_object_registration (void)
|
||||
g_assert (g_dbus_connection_unregister_object (c, boss_foo_reg_id));
|
||||
g_assert (g_dbus_connection_unregister_object (c, boss_bar_reg_id));
|
||||
g_assert (g_dbus_connection_unregister_object (c, worker1_foo_reg_id));
|
||||
g_assert (g_dbus_connection_unregister_object (c, worker1p1_foo_reg_id));
|
||||
g_assert (g_dbus_connection_unregister_object (c, worker2_bar_reg_id));
|
||||
g_assert (g_dbus_connection_unregister_object (c, intern1_foo_reg_id));
|
||||
g_assert (g_dbus_connection_unregister_object (c, intern2_bar_reg_id));
|
||||
|
Loading…
Reference in New Issue
Block a user