[Dextrose] [sugar PATCH] sl#3326: Do not attach any signals to the dangling-connection-object after it has called the "__connection_ready_cb" callback.

Ajay Garg ajay at activitycentral.com
Wed Jul 25 16:52:42 EDT 2012


Thanks to Jerry Vonau, for inspiring and guiding me to solve this :-)


 src/jarabe/model/neighborhood.py |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/jarabe/model/neighborhood.py b/src/jarabe/model/neighborhood.py
index 39f648e..5692ca9 100644
--- a/src/jarabe/model/neighborhood.py
+++ b/src/jarabe/model/neighborhood.py
@@ -260,6 +260,25 @@ class _Account(gobject.GObject):
                                       ready_handler=self.__connection_ready_cb)
 
     def __connection_ready_cb(self, connection):
+        # http://bugs.sugarlabs.org/ticket/3326
+        #
+        # Daniel Drake has given a comprehensive description of the
+        # issue. So the fix is that, when the
+        # dangling-connection-object calls the "__connection_ready_cb",
+        # check to see if it is the same as the referenced
+        # "self._connection" object. If not, simply return; this would
+        # have the following consequences ::
+        #
+        #  (i)
+        #  not connect any more signals to the
+        #  dangling-connection-object.
+        #
+        #  (ii)
+        #  the dangling-connection-object would finally be
+        #  garbage-collected.
+        if connection != self._connection:
+            return
+
         logging.debug('_Account.__connection_ready_cb %r',
                       connection.object_path)
         connection.connect_to_signal('StatusChanged',
-- 
1.7.4.4



More information about the Dextrose mailing list