Fix for re-entrant main window close when user hits 'x' again (#724)
Fixes #10897
This commit is contained in:
parent
999a3937d1
commit
a02d7d0176
@ -496,7 +496,7 @@ class ViewManager(CLIManager):
|
|||||||
"""
|
"""
|
||||||
Connects the signals needed
|
Connects the signals needed
|
||||||
"""
|
"""
|
||||||
self.window.connect('delete-event', self.quit)
|
self.del_event = self.window.connect('delete-event', self.quit)
|
||||||
self.notebook.connect('switch-page', self.view_changed)
|
self.notebook.connect('switch-page', self.view_changed)
|
||||||
if _GTKOSXAPPLICATION:
|
if _GTKOSXAPPLICATION:
|
||||||
self.macapp.connect('NSApplicationWillTerminate', self.quit)
|
self.macapp.connect('NSApplicationWillTerminate', self.quit)
|
||||||
@ -801,12 +801,22 @@ class ViewManager(CLIManager):
|
|||||||
self.dbstate.no_database()
|
self.dbstate.no_database()
|
||||||
self.post_close_db()
|
self.post_close_db()
|
||||||
|
|
||||||
|
def no_del_event(self, *obj):
|
||||||
|
""" Routine to prevent window destroy with default handler if user
|
||||||
|
hits 'x' multiple times. """
|
||||||
|
return True
|
||||||
|
|
||||||
def quit(self, *obj):
|
def quit(self, *obj):
|
||||||
"""
|
"""
|
||||||
Closes out the program, backing up data
|
Closes out the program, backing up data
|
||||||
"""
|
"""
|
||||||
# mark interface insenstitive to prevent unexpected events
|
# mark interface insenstitive to prevent unexpected events
|
||||||
self.uistate.set_sensitive(False)
|
self.uistate.set_sensitive(False)
|
||||||
|
# the following prevents reentering quit if user hits 'x' again
|
||||||
|
self.window.disconnect(self.del_event)
|
||||||
|
# the following prevents premature closing of main window if user
|
||||||
|
# hits 'x' multiple times.
|
||||||
|
self.window.connect('delete-event', self.no_del_event)
|
||||||
|
|
||||||
# backup data
|
# backup data
|
||||||
if config.get('database.backup-on-exit'):
|
if config.get('database.backup-on-exit'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user