mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-06 02:18:05 +02:00
DBusConnection: use atomic accesses to refcount in assertions/initial ref
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38005
This commit is contained in:
parent
dc6ae73598
commit
a725cca0ac
1 changed files with 6 additions and 5 deletions
|
|
@ -1318,8 +1318,9 @@ _dbus_connection_new_for_transport (DBusTransport *transport)
|
|||
|
||||
if (_dbus_modify_sigpipe)
|
||||
_dbus_disable_sigpipe ();
|
||||
|
||||
connection->refcount.value = 1;
|
||||
|
||||
/* initialized to 0: use atomic op to avoid mixing atomic and non-atomic */
|
||||
_dbus_atomic_inc (&connection->refcount);
|
||||
connection->transport = transport;
|
||||
connection->watches = watch_list;
|
||||
connection->timeouts = timeout_list;
|
||||
|
|
@ -2655,9 +2656,9 @@ _dbus_connection_last_unref (DBusConnection *connection)
|
|||
DBusList *link;
|
||||
|
||||
_dbus_verbose ("Finalizing connection %p\n", connection);
|
||||
|
||||
_dbus_assert (connection->refcount.value == 0);
|
||||
|
||||
|
||||
_dbus_assert (_dbus_atomic_get (&connection->refcount) == 0);
|
||||
|
||||
/* You have to disconnect the connection before unref:ing it. Otherwise
|
||||
* you won't get the disconnected message.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue