Module: deluge
Branch: master
Commit: de79bba5405c5deb1dc5d527c4b57be33b55da61

Author: Andrew Resch <[email protected]>
Date:   Tue Jun 22 18:24:27 2010 -0700

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.

---

 deluge/ui/gtkui/gtkui.py   |    6 ------
 deluge/ui/gtkui/menubar.py |    2 --
 deluge/ui/sessionproxy.py  |    6 +++++-
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/deluge/ui/gtkui/gtkui.py b/deluge/ui/gtkui/gtkui.py
index f784bd3..bfec91b 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 1fe549a..7f16b11 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 42451ae..718c951 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, {}]

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to