summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Resch <andrewresch@gmail.com>2010-06-22 18:24:27 -0700
committerAndrew Resch <andrewresch@gmail.com>2010-06-22 18:25:50 -0700
commit571d1079f66a1025f4f15e296934c46dbf00a965 (patch)
tree90d918cb9505510ce429b54f34dab456221bd3dc
parent0497c407e1ca93773aae376ecbf92327e1640826 (diff)
downloaddeluge-571d1079f66a1025f4f15e296934c46dbf00a965.tar.gz
deluge-571d1079f66a1025f4f15e296934c46dbf00a965.tar.bz2
deluge-571d1079f66a1025f4f15e296934c46dbf00a965.zip
Fix #1302 an uncaught exception in an state_changed event handler in SessionProxy was preventing the
TorrentManager's stop method from properly saving all the resume data.
-rw-r--r--deluge/ui/gtkui/gtkui.py6
-rw-r--r--deluge/ui/gtkui/menubar.py2
-rw-r--r--deluge/ui/sessionproxy.py6
3 files changed, 5 insertions, 9 deletions
diff --git a/deluge/ui/gtkui/gtkui.py b/deluge/ui/gtkui/gtkui.py
index f784bd3bb..bfec91b3a 100644
--- a/deluge/ui/gtkui/gtkui.py
+++ b/deluge/ui/gtkui/gtkui.py
@@ -252,12 +252,6 @@ class GtkUI(object):
# Shutdown all components
component.shutdown()
- if self.started_in_classic:
- try:
- client.daemon.shutdown()
- except:
- pass
-
# Make sure the config is saved.
self.config.save()
diff --git a/deluge/ui/gtkui/menubar.py b/deluge/ui/gtkui/menubar.py
index 1fe549afa..7f16b1132 100644
--- a/deluge/ui/gtkui/menubar.py
+++ b/deluge/ui/gtkui/menubar.py
@@ -260,8 +260,6 @@ class MenuBar(component.Component):
def on_menuitem_quit_activate(self, data=None):
log.debug("on_menuitem_quit_activate")
- if self.config["classic_mode"] and client.is_classicmode():
- client.daemon.shutdown()
self.window.quit()
## Edit Menu ##
diff --git a/deluge/ui/sessionproxy.py b/deluge/ui/sessionproxy.py
index 42451ae65..718c95104 100644
--- a/deluge/ui/sessionproxy.py
+++ b/deluge/ui/sessionproxy.py
@@ -76,6 +76,9 @@ class SessionProxy(component.Component):
return client.core.get_torrents_status({}, [], True).addCallback(on_torrent_status)
def stop(self):
+ client.deregister_event_handler("TorrentStateChangedEvent", self.on_torrent_state_changed)
+ client.deregister_event_handler("TorrentRemovedEvent", self.on_torrent_removed)
+ client.deregister_event_handler("TorrentAddedEvent", self.on_torrent_added)
self.torrents = {}
def create_status_dict(self, torrent_ids, keys):
@@ -197,7 +200,8 @@ class SessionProxy(component.Component):
return d.addCallback(on_status, None, keys)
def on_torrent_state_changed(self, torrent_id, state):
- self.torrents[torrent_id][1]["state"] = state
+ if torrent_id in self.torrents:
+ self.torrents[torrent_id][1]["state"] = state
def on_torrent_added(self, torrent_id):
self.torrents[torrent_id] = [time.time() - self.cache_time - 1, {}]