#5004 Fix race that caused multiple fake icons appear in the activity frame after installing a bundle with Browse.

This commit is contained in:
Tomeu Vizoso 2007-11-18 19:25:28 +01:00
parent 5c951a5ca2
commit 2ddc1bec4c
2 changed files with 13 additions and 3 deletions

3
NEWS
View File

@ -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)

View File

@ -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)