From b12243f43cd241418a79d1c8157137a4397864a9 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 14 Jan 2011 18:00:16 +0000 Subject: [PATCH 5/5] bus/test: assert that the client isn't listed, when appropriate If it was already in the list in these situations, it would be a reference leak. --- bus/test.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/bus/test.c b/bus/test.c index 6efad6e..d05c8fa 100644 --- a/bus/test.c +++ b/bus/test.c @@ -133,6 +133,9 @@ bus_setup_debug_client (DBusConnection *connection) { dbus_bool_t retval; + /* it had better not be there already */ + _dbus_assert (_dbus_list_find_last (&clients, connection) == NULL); + if (!dbus_connection_add_filter (connection, client_disconnect_filter, NULL, NULL)) @@ -179,7 +182,9 @@ bus_setup_debug_client (DBusConnection *connection) dbus_connection_set_timeout_functions (connection, NULL, NULL, NULL, NULL, NULL); - _dbus_list_remove_last (&clients, connection); + /* we failed to add it (the last thing we do) or never tried, so it + * had better not be there */ + _dbus_assert (_dbus_list_find_last (&clients, connection) == NULL); if (clients == NULL) { -- 1.7.2.3