summaryrefslogtreecommitdiffstats
path: root/dbus
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-03-17 03:09:31 +0000
committerHavoc Pennington <hp@redhat.com>2003-03-17 03:09:31 +0000
commit15f02e1071ab14a7bc937cb61a4439a69c14f1a5 (patch)
tree5e2144d421b2f4288df7c32acf091bd70be6f525 /dbus
parent0e298fbeb513ea03d1ddc80124aec3a1d19a967d (diff)
2003-03-16 Havoc Pennington <hp@pobox.com>
* dbus/dbus-bus.c (ensure_bus_data): fix double-unref of the data slot
Diffstat (limited to 'dbus')
-rw-r--r--dbus/dbus-bus.c18
-rw-r--r--dbus/dbus-connection.c2
2 files changed, 13 insertions, 7 deletions
diff --git a/dbus/dbus-bus.c b/dbus/dbus-bus.c
index 8f7fb90e..c05d74a5 100644
--- a/dbus/dbus-bus.c
+++ b/dbus/dbus-bus.c
@@ -83,12 +83,16 @@ data_slot_ref (void)
dbus_mutex_lock (slot_lock);
if (bus_data_slot < 0)
- bus_data_slot = dbus_connection_allocate_data_slot ();
-
- if (bus_data_slot < 0)
{
- dbus_mutex_unlock (slot_lock);
- return FALSE;
+ bus_data_slot = dbus_connection_allocate_data_slot ();
+
+ if (bus_data_slot < 0)
+ {
+ dbus_mutex_unlock (slot_lock);
+ return FALSE;
+ }
+
+ _dbus_assert (bus_data_slot_refcount == 0);
}
bus_data_slot_refcount += 1;
@@ -103,8 +107,8 @@ data_slot_unref (void)
{
dbus_mutex_lock (slot_lock);
- _dbus_assert (bus_data_slot >= 0);
_dbus_assert (bus_data_slot_refcount > 0);
+ _dbus_assert (bus_data_slot >= 0);
bus_data_slot_refcount -= 1;
@@ -149,7 +153,7 @@ ensure_bus_data (DBusConnection *connection)
if (!dbus_connection_set_data (connection, bus_data_slot, bd,
bus_data_free))
{
- bus_data_free (bd);
+ dbus_free (bd);
data_slot_unref ();
return NULL;
}
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
index d6ee104a..ed677e74 100644
--- a/dbus/dbus-connection.c
+++ b/dbus/dbus-connection.c
@@ -866,6 +866,8 @@ _dbus_connection_last_unref (DBusConnection *connection)
DBusHashIter iter;
DBusList *link;
+ _dbus_assert (connection->refcount == 0);
+
/* You have to disconnect the connection before unref:ing it. Otherwise
* you won't get the disconnected message.
*/