Fix #1895 : Files Tab showing wrong files due to torrent_info race condition

This commit is contained in:
Calum Lind 2011-07-11 22:38:02 +01:00
parent bebdec9ebb
commit 3b1ac4e81f
1 changed files with 6 additions and 2 deletions

View File

@ -334,7 +334,7 @@ class FilesTab(Tab):
log.debug("Getting file list from core..") log.debug("Getting file list from core..")
status_keys += ["files"] status_keys += ["files"]
component.get("SessionProxy").get_torrent_status(self.torrent_id, status_keys).addCallback(self._on_get_torrent_status) component.get("SessionProxy").get_torrent_status(self.torrent_id, status_keys).addCallback(self._on_get_torrent_status, self.torrent_id)
def clear(self): def clear(self):
self.treestore.clear() self.treestore.clear()
@ -464,7 +464,11 @@ class FilesTab(Tab):
get_completed_bytes(self.treestore.iter_children(root)) get_completed_bytes(self.treestore.iter_children(root))
def _on_get_torrent_status(self, status): def _on_get_torrent_status(self, status, torrent_id):
# Check stored torrent id matches the callback id
if self.torrent_id != torrent_id:
return
# Store this torrent's compact setting # Store this torrent's compact setting
if "compact" in status: if "compact" in status:
self.__compact = status["compact"] self.__compact = status["compact"]