[Sugar-devel] [PATCH sugar-toolkit] Make sure the datastore entry is created in time OLPC #10755

Simon Schampijer simon at schampijer.de
Fri Jun 24 05:45:39 EDT 2011


To avoind that we try to access the datastore entry before
it has been created we need to move the creation code up.
Tested that no other operation like resuming has issues with
that change.

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

diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
index 35082cc..c1a708b 100644
--- a/src/sugar/activity/activity.py
+++ b/src/sugar/activity/activity.py
@@ -313,6 +313,11 @@ class Activity(Window, gtk.Container):
         self.shared_activity = None
         self._join_id = None
 
+        if handle.object_id is None and create_jobject:
+            logging.debug('Creating a jobject.')
+            self._jobject = self._initialize_journal_object()
+            self.set_title(self._jobject.metadata['title'])
+
         if handle.invited:
             wait_loop = gobject.MainLoop()
             self._client_handler = _ClientHandler(
@@ -328,10 +333,6 @@ class Activity(Window, gtk.Container):
                                                   warn_if_none=False)
             self._set_up_sharing(mesh_instance, share_scope)
 
-        if handle.object_id is None and create_jobject:
-            logging.debug('Creating a jobject.')
-            self._jobject = self._initialize_journal_object()
-            self.set_title(self._jobject.metadata['title'])
 
     def _initialize_journal_object(self):
         title = _('%s Activity') % get_bundle_name()
-- 
1.7.4.4



More information about the Sugar-devel mailing list