Fix error when trying to close name editor during long name group

mapping view rebuild.

Fixes #12328
This commit is contained in:
prculley 2021-07-26 11:35:10 -05:00 committed by Nick Hall
parent 6ba9722dee
commit 8ceccb4a28

View File

@ -366,6 +366,7 @@ class EditName(EditSecondary):
5/ local set, not global set --> set (change local) 5/ local set, not global set --> set (change local)
6/ local set, global set --> set (set to global if possible) 6/ local set, global set --> set (set to global if possible)
""" """
ngm = False # name group mapping setting
closeit = True closeit = True
surname = self.obj.get_primary_surname().get_surname() surname = self.obj.get_primary_surname().get_surname()
group_as= self.obj.get_group_as() group_as= self.obj.get_group_as()
@ -388,7 +389,7 @@ class EditName(EditSecondary):
val = q.run() val = q.run()
if val: if val:
#delete the grouping link on database #delete the grouping link on database
self.db.set_name_group_mapping(surname, None) ngm = None # delay setting until dialog closes
self.obj.set_group_as("") self.obj.set_group_as("")
else : else :
closeit = False closeit = False
@ -421,9 +422,9 @@ class EditName(EditSecondary):
val = q.run() val = q.run()
if val: if val:
if group_as == surname : if group_as == surname :
self.db.set_name_group_mapping(surname, None) ngm = None # delay setting until dialog closes
else: else:
self.db.set_name_group_mapping(surname, group_as) ngm = group_as # delay setting until dialog closes
self.obj.set_group_as("") self.obj.set_group_as("")
else: else:
if self.global_group_set : if self.global_group_set :
@ -455,10 +456,15 @@ class EditName(EditSecondary):
pass pass
if closeit: if closeit:
db = self.db # close cleanup loses self.db, so save for later
if self.callback: if self.callback:
self.callback(self.obj) self.callback(self.obj)
self.callback = None self.callback = None
self.close() self.close()
# bug 12328 to avoid gui interaction during view rebuild, delay
# the rebuild until closeing this dialog
if ngm is not False:
db.set_name_group_mapping(surname, ngm)
def _cleanup_on_exit(self): def _cleanup_on_exit(self):
""" """