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.
This commit is contained in:
Andrew Resch 2010-06-22 18:24:27 -07:00
parent d5881142aa
commit de79bba540
3 changed files with 5 additions and 9 deletions

View File

@ -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()

View File

@ -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 ##

View File

@ -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, {}]