From a226819f7013bd85f69304b3fab686be7c7067d0 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Fri, 22 Jun 2007 05:35:46 +0000 Subject: [PATCH] * src/Editors/_EditFamily.py (EditFamily.__do_save): Disconnect all signal handlers before committing data. svn: r8621 --- ChangeLog | 2 ++ src/Editors/_EditFamily.py | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a30a8282..ee030361e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ 2007-06-21 Alex Roitman + * src/Editors/_EditFamily.py (EditFamily.__do_save): Disconnect + all signal handlers before committing data. * src/GrampsCfg.py (cb_format_changed): Catch new exception; escape special chars from displayed span. * src/NameDisplay.py (_gen_cooked_func): Only replace known diff --git a/src/Editors/_EditFamily.py b/src/Editors/_EditFamily.py index 98df7d938..432086168 100644 --- a/src/Editors/_EditFamily.py +++ b/src/Editors/_EditFamily.py @@ -825,6 +825,20 @@ class EditFamily(EditPrimary): self.ok_button.set_sensitive(True) return + if not original and self.object_is_empty(): + QuestionDialog.ErrorDialog( + _("Cannot save family"), + _("No data exists for this family. " + "Please enter data or cancel the edit.")) + return + + # We disconnect the callbacks to all signals we connected earlier. + # This prevents the signals originating in any of the following + # commits from being caught by us again. + for key in self.signal_keys: + self.db.disconnect(key) + self.signal_keys = [] + if not original and not self.object_is_empty(): trans = self.db.transaction_begin() @@ -851,11 +865,6 @@ class EditFamily(EditPrimary): self.db.add_family(self.obj, trans) self.db.transaction_commit(trans,_("Add Family")) - elif not original and self.object_is_empty(): - QuestionDialog.ErrorDialog(_("Cannot save family"), - _("No data exists for this family. Please " - "enter data or cancel the edit.")) - return elif original and self.object_is_empty(): trans = self.db.transaction_begin() self.db.remove_family(self.obj.handle, trans)