From a3636ccdb77f0d4cbca941a1ec38606ff9a1b9c9 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sun, 11 Oct 2009 18:46:35 +0000 Subject: [PATCH] Fix saving torrent state on fresh configs Do not try to call doIteration() on the reactor if it has already stopped --- deluge/core/torrentmanager.py | 4 ++++ deluge/ui/gtkui/gtkui.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 3d947bb0e..152eec71c 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -132,6 +132,10 @@ class TorrentManager(component.Component): # Get the core config self.config = ConfigManager("core.conf") + # Make sure the state folder has been created + if not os.path.exists(os.path.join(get_config_dir(), "state")): + os.makedirs(os.path.join(get_config_dir(), "state")) + # Create the torrents dict { torrent_id: Torrent } self.torrents = {} diff --git a/deluge/ui/gtkui/gtkui.py b/deluge/ui/gtkui/gtkui.py index 767c7049d..8e3879356 100644 --- a/deluge/ui/gtkui/gtkui.py +++ b/deluge/ui/gtkui/gtkui.py @@ -233,7 +233,7 @@ class GtkUI(object): # Process any pending gtk events since the mainloop has been quit if not deluge.common.windows_check(): - while gtk.events_pending(): + while gtk.events_pending() and reactor.running: reactor.doIteration(0) # Shutdown all components