[Sugar-devel] [PATCH sugar] Make sure the connection is established before we use it SL #3119

Simon Schampijer simon at schampijer.de
Fri Oct 7 13:49:08 EDT 2011


The code is a bit racy. We need to make sure the connection is
already established to not get the traceback. Tested with
Salut and Gabble.

Signed-off-by: Simon Schampijer <simon at laptop.org>
---
 src/jarabe/model/neighborhood.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/jarabe/model/neighborhood.py b/src/jarabe/model/neighborhood.py
index 828cb14..158b0de 100644
--- a/src/jarabe/model/neighborhood.py
+++ b/src/jarabe/model/neighborhood.py
@@ -251,7 +251,10 @@ class _Account(gobject.GObject):
             self._check_registration_error()
             self._connection = None
         elif self._connection is None:
-            self._prepare_connection(properties['Connection'])
+            if 'ConnectionStatus' not in properties:
+                return
+            if properties['ConnectionStatus'] == CONNECTION_STATUS_CONNECTED:
+                self._prepare_connection(properties['Connection'])
 
     def _prepare_connection(self, connection_path):
         connection_name = connection_path.replace('/', '.')[1:]
-- 
1.7.4.4



More information about the Sugar-devel mailing list