[GTKUI] Fix open dialogs preventing gtk app closing

This commit is contained in:
Calum Lind 2015-11-15 12:47:07 +00:00
parent 058b0e41d2
commit fc9bc2976f
1 changed files with 6 additions and 0 deletions

View File

@ -237,6 +237,8 @@ class GtkUI(object):
self.daemon_bps = (0, 0, 0) self.daemon_bps = (0, 0, 0)
self.rpc_stats = LoopingCall(self.print_rpc_stats) self.rpc_stats = LoopingCall(self.print_rpc_stats)
# Twisted catches signals to terminate, so have it call a pre_shutdown method.
reactor.addSystemEventTrigger("before", "shutdown", self.pre_shutdown)
reactor.callWhenRunning(self._on_reactor_start) reactor.callWhenRunning(self._on_reactor_start)
# Initialize gdk threading # Initialize gdk threading
@ -260,6 +262,10 @@ class GtkUI(object):
# Make sure the config is saved. # Make sure the config is saved.
self.config.save() self.config.save()
def pre_shutdown(self, *args, **kwargs):
"""Modal dialogs can prevent the application exiting so destroy mainwindow"""
self.mainwindow.window.destroy()
def print_rpc_stats(self): def print_rpc_stats(self):
if not client.connected(): if not client.connected():
return return