Fixing a bug where telepathy-theonering wasn't included in packages
[theonering] / src / channel / contact_list.py
index 970b809..7f9981d 100644 (file)
@@ -31,9 +31,16 @@ class AllContactsListChannel(AbstractListChannel):
 
        def __init__(self, connection, h):
                AbstractListChannel.__init__(self, connection, h)
+
+               self._callback = coroutines.func_sink(
+                       coroutines.expand_positional(
+                               self._on_contacts_refreshed
+                       )
+               )
                self._session.addressbook.updateSignalHandler.register_sink(
-                       self._on_contacts_refreshed
+                       self._callback
                )
+
                self.GroupFlagsChanged(0, 0)
 
                addressbook = connection.session.addressbook
@@ -42,15 +49,20 @@ class AllContactsListChannel(AbstractListChannel):
 
        @gtk_toolbox.log_exception(_moduleLogger)
        def Close(self):
-               telepathy.server.ChannelTypeContactList.Close(self)
-               self.remove_from_connection()
+               self.close()
+
+       def close(self):
                self._session.addressbook.updateSignalHandler.unregister_sink(
-                       self._on_contacts_refreshed
+                       self._callback
                )
+               self._callback = None
+
+               telepathy.server.ChannelTypeContactList.Close(self)
+               self.remove_from_connection()
+               self._prop_getters = None # HACK to get around python-telepathy memory leaks
 
-       @coroutines.func_sink
-       @coroutines.expand_positional
        @gobject_utils.async
+       @gtk_toolbox.log_exception(_moduleLogger)
        def _on_contacts_refreshed(self, addressbook, added, removed, changed):
                self._process_refresh(addressbook, added, removed)