Blob Blame History Raw
From cdf570506b77eca62ac8e5a5bfe2a1db0fbb1123 Mon Sep 17 00:00:00 2001
From: Scott James Remnant <scott@netsplit.com>
Date: Thu, 24 Apr 2008 15:58:34 +0100
Subject: [PATCH] 	* dbus/dbus-connection.c (connection_forget_shared_unlocked):
 	Remove shared connections which lack a GUID from the list that
 	caches those, otherwise references to them will remain after
 	they have been freed.

---
 dbus/dbus-connection.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
index 3a1670c..5b25534 100644
--- a/dbus/dbus-connection.c
+++ b/dbus/dbus-connection.c
@@ -1671,21 +1671,26 @@ connection_forget_shared_unlocked (DBusConnection *connection)
   if (!connection->shareable)
     return;
   
+  _DBUS_LOCK (shared_connections);
+      
   if (connection->server_guid != NULL)
     {
       _dbus_verbose ("dropping connection to %s out of the shared table\n",
                      connection->server_guid);
       
-      _DBUS_LOCK (shared_connections);
-      
       if (!_dbus_hash_table_remove_string (shared_connections,
                                            connection->server_guid))
         _dbus_assert_not_reached ("connection was not in the shared table");
       
       dbus_free (connection->server_guid);
       connection->server_guid = NULL;
-      _DBUS_UNLOCK (shared_connections);
     }
+  else
+    {
+      _dbus_list_remove (&shared_connections_no_guid, connection);
+    }
+
+  _DBUS_UNLOCK (shared_connections);
   
   /* remove our reference held on all shareable connections */
   _dbus_connection_unref_unlocked (connection);
-- 
1.5.4.3