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
This commit is contained in:
prculley 2017-02-20 11:32:22 -06:00
parent 314f7cce65
commit e74dc2fa8c

View File

@ -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):