[Sugar-devel] [PATCH] _update_signal_match wasn't initialized

Raul Gutierrez Segales rgs at rieder.net.py
Tue Apr 27 09:43:21 EDT 2010


On Tue, 2010-04-27 at 11:25 +1000, James Cameron wrote:
> On Mon, Apr 26, 2010 at 03:50:17PM -0400, Raul Gutierrez Segales wrote:
> > Because of missing initialization and a weak test for the existence of
> > the object  (self._update_signal_match is not None) Turtle Art was
> > crashing when resuming from the Journal.
> Reviewed, but I didn't understand.  This might be my fault.
> Your patch appears to be to sugar-toolkit.


> self._update_signal_match is only used in DSObject, it is already
> initialised in sugar-toolkit 0.84.9, and you're adding the
> initialisation to DSMetadata, where it is not used.

Sorry, this was done on the run.. Because we were spinning new builds. 

Looking at it with more detail, the problem is that
self._update_signal_match is initialized in the wrong order (after a
call to set_object_id that depends on it). 

diff --git a/src/sugar/datastore/datastore.py
index 6ff10de..7aa4d15 100644
--- a/src/sugar/datastore/datastore.py
+++ b/src/sugar/datastore/datastore.py
@@ -109,12 +109,12 @@ class DSMetadata(gobject.GObject):
 class DSObject(object):
     def __init__(self, object_id, metadata=None, file_path=None):
+        self._update_signal_match = None
         self._metadata = metadata
         self._file_path = file_path
         self._destroyed = False
         self._owns_file = False
-        self._update_signal_match = None
     def get_object_id(self):
         return self._object_id

More information about the Sugar-devel mailing list