From 46a1eb26cf3b958f7c1c5c59b09f5c848c969f02 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Tue, 8 Apr 2008 12:02:08 +0000 Subject: [PATCH] Fix peers list updating. --- deluge/core/core.py | 2 +- deluge/ui/gtkui/peers_tab.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/deluge/core/core.py b/deluge/core/core.py index fe2848b9a..08def8c58 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -262,7 +262,7 @@ class Core( except KeyboardInterrupt: self._shutdown() - def _shutdown(self, data=None): + def _shutdown(self, *data): """This is called by a thread from shutdown()""" log.info("Shutting down core..") component.shutdown() diff --git a/deluge/ui/gtkui/peers_tab.py b/deluge/ui/gtkui/peers_tab.py index fd7956acd..c523f3f90 100644 --- a/deluge/ui/gtkui/peers_tab.py +++ b/deluge/ui/gtkui/peers_tab.py @@ -241,20 +241,24 @@ class PeersTab: if self.peers.has_key(peer["ip"]): # We already have this peer in our list, so lets just update it row = self.peers[peer["ip"]] + if not self.liststore.iter_is_valid(row): + # This iter is invalid, delete it and continue to next iteration + del self.peers[peer["ip"]] + continue values = self.liststore.get(row, 3, 4, 5, 7) if peer["down_speed"] != values[0]: - self.liststore.set_value(row, 3, values[0]) + self.liststore.set_value(row, 3, peer["down_speed"]) if peer["up_speed"] != values[1]: - self.liststore.set_value(row, 4, values[1]) + self.liststore.set_value(row, 4, peer["up_speed"]) if peer["country"] != values[2]: - self.liststore.set_value(row, 5, values[2]) + self.liststore.set_value(row, 5, peer["country"]) if peer["seed"]: icon = self.seed_pixbuf else: icon = self.peer_pixbuf - if icon != values[2]: - self.liststore.set_value(row, 7, values[3]) + if icon != values[3]: + self.liststore.set_value(row, 7, icon) else: # Peer is not in list so we need to add it