From 9c879279a60c8c7bfb1ad08963f1370002432053 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Wed, 14 May 2014 00:52:04 +0100 Subject: [PATCH] Prevent removing idle process after it has finished --- gramps/gui/editors/displaytabs/backrefmodel.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gramps/gui/editors/displaytabs/backrefmodel.py b/gramps/gui/editors/displaytabs/backrefmodel.py index ff785e1af..96143afba 100644 --- a/gramps/gui/editors/displaytabs/backrefmodel.py +++ b/gramps/gui/editors/displaytabs/backrefmodel.py @@ -55,13 +55,15 @@ class BackRefModel(Gtk.ListStore): self.db = db self.sref_list = sref_list self.count = 0 + self.loading = False if sys.version_info[0] < 3: self.idle = GLib.idle_add(self.load_model().next) else: self.idle = GLib.idle_add(self.load_model().__next__) def destroy(self): - GLib.source_remove(self.idle) + if self.loading: + GLib.source_remove(self.idle) def load_model(self): """ @@ -72,6 +74,7 @@ class BackRefModel(Gtk.ListStore): while the GUI using this model is no longer used. Disconnect any methods before closing the GUI. """ + self.loading = True self.count = 0 for ref in self.sref_list: self.count += 1 @@ -148,4 +151,5 @@ class BackRefModel(Gtk.ListStore): # but we don't need to show that in the view. self.append(row=[_(dtype), gid, name, handle, dtype]) yield True + self.loading = False yield False