From fc0114a7e28f5b28d6448ec900852dc485b1640d Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Sun, 11 Sep 2016 22:40:23 +1000 Subject: [PATCH] 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. --- gtk2_ardour/editor_drag.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 8e614a8471..c35d1fedef 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -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::const_iterator i = _views.begin(); i != _views.end(); ++i) {