Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@tomeuvizoso.net>2007-11-18 18:25:28 (GMT)
committer Tomeu Vizoso <tomeu@tomeuvizoso.net>2007-11-18 18:25:28 (GMT)
commit2ddc1bec4c170b5022eb67b7d0451fa4546f8c4a (patch)
tree63884cb6d9df93aa937293c085520a5a4620f01a
parent5c951a5ca202f5687fce670df805141ccc698fda (diff)
#5004 Fix race that caused multiple fake icons appear in the activity frame after installing a bundle with Browse.
-rw-r--r--NEWS3
-rw-r--r--lib/sugar/activity/registry.py13
2 files changed, 13 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index d4bfa7d..a248830 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+* #5004 Fix race that caused multiple fake icons appear in the activity frame
+ after installing a bundle with Browse. (tomeu)
+
Snapshot 411879e9de
* #4768 Fix memory leak when switching between activities. (marco)
diff --git a/lib/sugar/activity/registry.py b/lib/sugar/activity/registry.py
index a279aa9..c21d4a5 100644
--- a/lib/sugar/activity/registry.py
+++ b/lib/sugar/activity/registry.py
@@ -130,13 +130,20 @@ class ActivityRegistry(gobject.GObject):
return activities
def add_bundle(self, bundle_path):
- return self._registry.AddBundle(bundle_path)
+ result = self._registry.AddBundle(bundle_path)
+ # Need to invalidate here because get_activity could be called after
+ # add_bundle and before we receive activity-added, causing a race.
+ self._invalidate_cache()
+ return result
def _activity_added_cb(self, info_dict):
- logging.debug('ActivityRegistry._activity_added_cb: flushing caches')
+ logging.debug('ActivityRegistry._activity_added_cb: invalidating cache')
+ self._invalidate_cache()
+ self.emit('activity-added', _activity_info_from_dict(info_dict))
+
+ def _invalidate_cache(self):
self._service_name_to_activity_info.clear()
self._mime_type_to_activities.clear()
- self.emit('activity-added', _activity_info_from_dict(info_dict))
def remove_bundle(self, bundle_path):
return self._registry.RemoveBundle(bundle_path)