Skip to content

Commit

Permalink
fix Undo; crashes due to race in Gtk
Browse files Browse the repository at this point in the history
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
  • Loading branch information
prculley authored and Nick-Hall committed Sep 1, 2017
1 parent 86e2d96 commit 2eb1f31
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gramps/gui/undohistory.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,11 @@ def __init__(self, dbstate, uistate):
scrolled_window.add(self.tree)
self.window.vbox.pack_start(scrolled_window, True, True, 0)

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):
Expand Down Expand Up @@ -226,6 +227,7 @@ def _update_ui(self):
)

def _build_model(self):
self.selection.handler_block(self.sel_chng_hndlr)
self.model.clear()
fg = bg = None

Expand All @@ -243,6 +245,7 @@ def _build_model(self):
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):
Expand Down

0 comments on commit 2eb1f31

Please sign in to comment.