Calling view.run_command('redo') inside of an edit in an on_modified callback (i.e. between view.begin_edit and view.end_edit), and then making a change and hitting undo twice crashes Sublime. I haven't looked to see if it happens in more cases than this.
pending = 0
def on_modified(self, view):
if self.pending == 1:
self.pending = 1
edit = view.begin_edit()
self.pending = 0
Save this code as a plugin, edit a buffer, and hit undo twice.
I ran into this because I'm trying to add to a closed edit—i.e., when the user types something, I want to modify the buffer, but I want to do it in such a way that hitting undo once will undo both my changes and their changes. I tried to call "undo", and then start an edit and call "redo" and make my changes before closing the edit, and that's when I ran into this issue.