Module: deluge
Branch: refs/tags/archive/1.2-stable
Commit: 8c3683045631ad237b4f5d9fed81bedc9996729c

Author: John Garland <johnnybg+del...@gmail.com>
Date:   Sat Oct 23 00:46:50 2010 +1100

Fix hang on quit

---

 ChangeLog                     |    1 +
 deluge/ui/gtkui/mainwindow.py |   15 ++++++++++-----
 deluge/ui/gtkui/menubar.py    |    5 +----
 deluge/ui/gtkui/systemtray.py |    6 +-----
 4 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3fd5998..e544dd6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
          of string.  This fixes a problem where using lt 0.14.10 wouldn't allow
          Deluge to start.
        * Fix libtorrent 0.15 compatibility
+       * Fix hang on quit
 
 === Deluge 1.2.2 (19 March 2010) ===
 ==== Core ====
diff --git a/deluge/ui/gtkui/mainwindow.py b/deluge/ui/gtkui/mainwindow.py
index 47887c1..344359f 100644
--- a/deluge/ui/gtkui/mainwindow.py
+++ b/deluge/ui/gtkui/mainwindow.py
@@ -152,11 +152,16 @@ class MainWindow(component.Component):
         """Returns a reference to the main window glade object."""
         return self.main_glade
 
-    def quit(self):
-        if client.is_classicmode():
-            gtk.main_quit()
-        else:
-            reactor.stop()
+    def quit(self, shutdown=False):
+        """
+        Quits the GtkUI
+
+        :param shutdown: whether or not to shutdown the daemon as well
+        :type shutdown: boolean
+        """
+        if shutdown:
+            client.daemon.shutdown()
+        reactor.stop()
 
     def load_window_state(self):
         x = self.config["window_x_pos"]
diff --git a/deluge/ui/gtkui/menubar.py b/deluge/ui/gtkui/menubar.py
index 1f62db0..1ec9e21 100644
--- a/deluge/ui/gtkui/menubar.py
+++ b/deluge/ui/gtkui/menubar.py
@@ -253,10 +253,7 @@ class MenuBar(component.Component):
 
     def on_menuitem_quitdaemon_activate(self, data=None):
         log.debug("on_menuitem_quitdaemon_activate")
-        # Tell the core to shutdown
-        def on_shutdown(result):
-            self.window.quit()
-        client.daemon.shutdown().addCallback(on_shutdown)
+        self.window.quit(shutdown=True)
 
     def on_menuitem_quit_activate(self, data=None):
         log.debug("on_menuitem_quit_activate")
diff --git a/deluge/ui/gtkui/systemtray.py b/deluge/ui/gtkui/systemtray.py
index ae0ac60..16dca30 100644
--- a/deluge/ui/gtkui/systemtray.py
+++ b/deluge/ui/gtkui/systemtray.py
@@ -324,9 +324,6 @@ class SystemTray(component.Component):
         if self.config["lock_tray"] and not self.window.visible():
             self.unlock_tray()
 
-        if self.config["classic_mode"]:
-            client.daemon.shutdown()
-
         self.window.quit()
 
     def on_menuitem_quitdaemon_activate(self, menuitem):
@@ -334,8 +331,7 @@ class SystemTray(component.Component):
         if self.config["lock_tray"] and not self.window.visible():
             self.unlock_tray()
 
-        client.daemon.shutdown()
-        self.window.quit()
+        self.window.quit(shutdown=True)
 
     def tray_setbwdown(self, widget, data=None):
         self.setbwlimit(widget, _("Set Maximum Download Speed"), 
"max_download_speed",

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

Reply via email to