summaryrefslogtreecommitdiffstats
path: root/extra/deluge/fix_freeze.patch
blob: 2991ca770995ccd57aa5a5e5155e84ebc47b1789 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
 
diff --git a/deluge/ui/gtkui/connectionmanager.py b/deluge/ui/gtkui/connectionmanager.py
index 554c570..3b9ddf4 100644
--- a/deluge/ui/gtkui/connectionmanager.py
+++ b/deluge/ui/gtkui/connectionmanager.py
@@ -99,12 +99,16 @@ class ConnectionManager(component.Component):
 
         self.config = ConfigManager("hostlist.conf.1.2", DEFAULT_CONFIG)
 
+        self.running = False
+
     # Component overrides
     def start(self):
         pass
 
     def stop(self):
-        pass
+        # Close this dialog when we are shutting down
+        if self.running:
+            self.connection_manager.response(gtk.RESPONSE_CLOSE)
 
     def shutdown(self):
         pass
diff --git a/deluge/ui/gtkui/gtkui.py b/deluge/ui/gtkui/gtkui.py
index 255622a..4856986 100644
--- a/deluge/ui/gtkui/gtkui.py
+++ b/deluge/ui/gtkui/gtkui.py
@@ -167,7 +167,7 @@ class GtkUI(object):
             self.gnome_prog = gnome.init("Deluge", deluge.common.get_version())
             self.gnome_client = gnome.ui.master_client()
             def on_die(*args):
-                gtk.main_quit()
+                reactor.stop()
             self.gnome_client.connect("die", on_die)
             log.debug("GNOME session 'die' handler registered!")
         except Exception, e:
@@ -180,7 +180,7 @@ class GtkUI(object):
             def win_handler(ctrl_type):
                 log.debug("ctrl_type: %s", ctrl_type)
                 if ctrl_type in (CTRL_CLOSE_EVENT, CTRL_SHUTDOWN_EVENT):
-                    gtk.main_quit()
+                    reactor.stop()
                     return 1
             SetConsoleCtrlHandler(win_handler)
 
diff --git a/deluge/ui/gtkui/mainwindow.py b/deluge/ui/gtkui/mainwindow.py
index ad33fd0..1153b1e 100644
--- a/deluge/ui/gtkui/mainwindow.py
+++ b/deluge/ui/gtkui/mainwindow.py
@@ -46,6 +46,7 @@ from deluge.ui.client import client
 import deluge.component as component
 from deluge.configmanager import ConfigManager
 from deluge.ui.gtkui.ipcinterface import process_args
+from twisted.internet import reactor
 
 import deluge.common
 import common
@@ -152,7 +153,7 @@ class MainWindow(component.Component):
         return self.main_glade
 
     def quit(self):
-        gtk.main_quit()
+        reactor.stop()
 
     def load_window_state(self):
         x = self.config["window_x_pos"]
@@ -238,7 +239,6 @@ class MainWindow(component.Component):
 
     def on_newversionavailable_event(self, new_version):
         if self.config["show_new_releases"]:
-            from twisted.internet import reactor
             from deluge.ui.gtkui.new_release_dialog import NewReleaseDialog
             reactor.callLater(5.0, NewReleaseDialog().show, new_version)