From 3b1ac4e81f329aa7ee8fd8ef332e51498bd386f4 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Mon, 11 Jul 2011 22:38:02 +0100 Subject: [PATCH] Fix #1895 : Files Tab showing wrong files due to torrent_info race condition --- deluge/ui/gtkui/files_tab.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/deluge/ui/gtkui/files_tab.py b/deluge/ui/gtkui/files_tab.py index 83c4da6ed..9624c748a 100644 --- a/deluge/ui/gtkui/files_tab.py +++ b/deluge/ui/gtkui/files_tab.py @@ -334,7 +334,7 @@ class FilesTab(Tab): log.debug("Getting file list from core..") 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): self.treestore.clear() @@ -464,7 +464,11 @@ class FilesTab(Tab): 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 if "compact" in status: self.__compact = status["compact"]