From e74dc2fa8c5be6ae644d20e005f96eda5e519b6a Mon Sep 17 00:00:00 2001 From: prculley Date: Mon, 20 Feb 2017 11:32:22 -0600 Subject: [PATCH] fix Undo; crashes due to race in Gtk Some Redraws occur during a model clear when the row changed signal is emmitted. Model is only partially cleared at that point. Under some conditions, some more of the model gets cleared before the redraw completes, and redraw fails. fixes #9932 --- gramps/gui/undohistory.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gramps/gui/undohistory.py b/gramps/gui/undohistory.py index 1e6ae8afa..99cb8e945 100644 --- a/gramps/gui/undohistory.py +++ b/gramps/gui/undohistory.py @@ -121,10 +121,11 @@ class UndoHistory(ManagedWindow): self.window.vbox.pack_start(scrolled_window, True, True, 0) self.window.show_all() + self.sel_chng_hndlr = self.selection.connect('changed', + self._selection_changed) self._build_model() self._update_ui() - self.selection.connect('changed', self._selection_changed) self.show() def _selection_changed(self, obj): @@ -227,6 +228,7 @@ class UndoHistory(ManagedWindow): ) def _build_model(self): + self.selection.handler_block(self.sel_chng_hndlr) self.model.clear() fg = bg = None @@ -244,6 +246,7 @@ class UndoHistory(ManagedWindow): mod_text = txn.get_description() self.model.append(row=[time_text, mod_text, fg, bg]) path = (self.undodb.undo_count,) + self.selection.handler_unblock(self.sel_chng_hndlr) self.selection.select_path(path) def update(self):