From 8735f8a014fe574970063e39fb93c02b79fc03bc Mon Sep 17 00:00:00 2001 From: Paul Culley Date: Fri, 1 Jun 2018 18:58:06 -0500 Subject: [PATCH] Fix dialogs for crash when canceling via 'x' (#620) * Fix import dialog for crash when canceling via 'x' Fixes #10607 * Fix 'Make Backup' dialog for crash on 'x' close Issue #10607 * Fix Family Lines/Family Colors/add dialog crash on close with 'x' Issue #10607 --- gramps/gui/dbloader.py | 5 +++-- gramps/gui/plug/_guioptions.py | 4 +++- gramps/gui/viewmanager.py | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gramps/gui/dbloader.py b/gramps/gui/dbloader.py index e4f80c90d..b33c7830c 100644 --- a/gramps/gui/dbloader.py +++ b/gramps/gui/dbloader.py @@ -485,9 +485,10 @@ class GrampsImportFileDialog(ManagedWindow): # the import_dialog.run() makes it modal, so any change to that # line would require the ManagedWindow.__init__ to be changed also response = import_dialog.run() - if response in (Gtk.ResponseType.CANCEL, - Gtk.ResponseType.DELETE_EVENT): + if response == Gtk.ResponseType.CANCEL: break + elif response == Gtk.ResponseType.DELETE_EVENT: + return elif response == Gtk.ResponseType.OK: filename = import_dialog.get_filename() if self.check_errors(filename): diff --git a/gramps/gui/plug/_guioptions.py b/gramps/gui/plug/_guioptions.py index a69b311f5..7115be627 100644 --- a/gramps/gui/plug/_guioptions.py +++ b/gramps/gui/plug/_guioptions.py @@ -156,7 +156,9 @@ class LastNameDialog(ManagedWindow): tree_iter = self.__model.get_iter(path) surname = self.__model.get_value(tree_iter, 0) surname_set.add(surname) - self.close() # ManagedWindow: set the parent dialog to be modal again + if response != Gtk.ResponseType.DELETE_EVENT: + # ManagedWindow: set the parent dialog to be modal again + self.close() return surname_set def build_menu_names(self, obj): diff --git a/gramps/gui/viewmanager.py b/gramps/gui/viewmanager.py index 5b493a9f4..fe0a8f999 100644 --- a/gramps/gui/viewmanager.py +++ b/gramps/gui/viewmanager.py @@ -1986,7 +1986,8 @@ class QuickBackup(ManagedWindow): # TODO move this class into its own module config.set('paths.quick-backup-directory', path_entry.get_text()) else: self.uistate.push_message(self.dbstate, _("Backup aborted")) - self.close() + if dbackup != Gtk.ResponseType.DELETE_EVENT: + self.close() def select_backup_path(self, widget, path_entry): """