Fix #7015, Crash while aborting Region trim using Esc key

There were two issues:

The first is that TrimDrag::aborted was calling TrimDrag::finished with a null
GdkEvent which caused a segfault when dereferencing. So avoid that by passing
in a dummy event as we are just going to undo the operation in the next step
anyway so it shouldn't matter if it is valid(AFAICT).

The other is that TrimDrag:aborted was calling Editor::undo() which was in turn
calling TrimDrag::aborted leading to infinite recursion and stack overflow.
Calling Session::undo() directly seems to avoid that issue.

This fix feels like a bit of a hack...but it seems to work and is better than a
crash.
This commit is contained in:
Tim Mayberry 2016-09-11 22:40:23 +10:00
parent f91e591f40
commit fc0114a7e2
1 changed files with 3 additions and 2 deletions

View File

@ -3087,10 +3087,11 @@ TrimDrag::aborted (bool movement_occurred)
behind which may be slightly odd from the user's point of view.
*/
finished (0, true);
GdkEvent ev;
finished (&ev, true);
if (movement_occurred) {
_editor->undo ();
_editor->session()->undo (1);
}
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {