[telepathy-glib/master] TpDBusDaemon: if destroyed with name ownership watches still outstanding, don't leak their structs etc.

Simon McVittie simon.mcvittie at collabora.co.uk
Sun Aug 16 10:14:25 PDT 2009


---
 telepathy-glib/dbus.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/telepathy-glib/dbus.c b/telepathy-glib/dbus.c
index e36fea9..8f9b6e4 100644
--- a/telepathy-glib/dbus.c
+++ b/telepathy-glib/dbus.c
@@ -1267,8 +1267,18 @@ tp_dbus_daemon_dispose (GObject *object)
   if (self->priv->name_owner_watches != NULL)
     {
       GHashTable *tmp = self->priv->name_owner_watches;
+      GHashTableIter iter;
+      gpointer k, v;
 
       self->priv->name_owner_watches = NULL;
+      g_hash_table_iter_init (&iter, tmp);
+
+      while (g_hash_table_iter_next (&iter, &k, &v))
+        {
+          _tp_dbus_daemon_stop_watching (self, k, v);
+          g_hash_table_iter_remove (&iter);
+        }
+
       g_hash_table_destroy (tmp);
     }
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list