From 2c64736604796f703cc9e2043ef646bdc450011d Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 29 Apr 2021 21:14:23 +0200 Subject: [PATCH] Fix crash when consolidating range with automation The undo command needs to be started before calling playlist->add_region() because that may move automation or include ripple changes. see the following backtrace: ``` UndoTransaction::add_command ARDOUR::DiskReader::move_processor_automation ARDOUR::Route::foreach_processor ARDOUR::DiskReader::playlist_ranges_moved ARDOUR::Playlist::flush_notifications ARDOUR::Playlist::RegionWriteLock::~RegionWriteLock ARDOUR::Playlist::add_region Editor::bounce_range_selection ``` Except. it seems automation is moved incorrectly in this case.. --- gtk2_ardour/editor_ops.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index cb8c63ba1c..8188e1a099 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -4191,6 +4191,11 @@ Editor::bounce_range_selection (bool replace, bool enable_processing) continue; } + if (!in_command) { + begin_reversible_command (_("bounce range")); + in_command = true; + } + if (replace) { /*remove the edxisting regions under the edit range*/ list ranges; @@ -4205,10 +4210,6 @@ Editor::bounce_range_selection (bool replace, bool enable_processing) playlist->add_region (copy, start); } - if (!in_command) { - begin_reversible_command (_("bounce range")); - in_command = true; - } vector cmds; playlist->rdiff (cmds); _session->add_commands (cmds); @@ -4216,7 +4217,7 @@ Editor::bounce_range_selection (bool replace, bool enable_processing) _session->add_command (new StatefulDiffCommand (playlist)); } - if (in_command) { + if (in_command && !_session->abort_empty_reversible_command ()) { commit_reversible_command (); } }