mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
gio: fix race condition in GDBusObjectManagerClient
priv->map_object_path_to_object_proxy must be protected to avoid concurrent access by multiple threads. Move the hash table insertion into the critical section. https://bugzilla.gnome.org/show_bug.cgi?id=788368
This commit is contained in:
parent
1fb56be6ab
commit
aeecd81dd1
@ -1542,6 +1542,13 @@ add_interfaces (GDBusObjectManagerClient *manager,
|
||||
g_variant_unref (properties);
|
||||
}
|
||||
|
||||
if (added)
|
||||
{
|
||||
g_hash_table_insert (manager->priv->map_object_path_to_object_proxy,
|
||||
g_strdup (object_path),
|
||||
op);
|
||||
}
|
||||
|
||||
g_mutex_unlock (&manager->priv->lock);
|
||||
|
||||
/* now that we don't hold the lock any more, emit signals */
|
||||
@ -1555,12 +1562,8 @@ add_interfaces (GDBusObjectManagerClient *manager,
|
||||
g_list_free (interface_added_signals);
|
||||
|
||||
if (added)
|
||||
{
|
||||
g_hash_table_insert (manager->priv->map_object_path_to_object_proxy,
|
||||
g_strdup (object_path),
|
||||
op);
|
||||
g_signal_emit_by_name (manager, "object-added", op);
|
||||
}
|
||||
g_signal_emit_by_name (manager, "object-added", op);
|
||||
|
||||
g_object_unref (manager);
|
||||
g_object_unref (op);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user