From bdc1cdc15fb147148116ac07ed437d5cec970056 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 10 Mar 2021 13:55:32 +0100 Subject: [PATCH] Fix crash when separating ranges with automation playlist->partition() calls DiskReader::playlist_ranges_moved() which may add Panner and Fader automation state changes. The reversible command has to be started before calling playlist->partition(). Simply collecting playlist->rdiff() after the fact is not sufficient. --- gtk2_ardour/editor_ops.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 128b90bf50..bbe45687ed 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -3190,6 +3190,11 @@ Editor::separate_regions_between (const TimeSelection& ts) for (list::const_iterator t = ts.begin(); t != ts.end(); ++t) { + if (!in_command) { + begin_reversible_command (_("separate")); + in_command = true; + } + sigc::connection c = rtv->view()->RegionViewAdded.connect ( sigc::mem_fun(*this, &Editor::collect_new_region_view)); @@ -3205,19 +3210,13 @@ Editor::separate_regions_between (const TimeSelection& ts) sigc::ptr_fun (add_if_covered), &(*t), &new_selection)); - if (!in_command) { - begin_reversible_command (_("separate")); - in_command = true; - } - /* pick up changes to existing regions */ vector cmds; playlist->rdiff (cmds); _session->add_commands (cmds); - /* pick up changes to the playlist itself (adds/removes) - */ + /* pick up changes to the playlist itself (adds/removes) */ _session->add_command(new StatefulDiffCommand (playlist)); } @@ -3226,6 +3225,9 @@ Editor::separate_regions_between (const TimeSelection& ts) } if (in_command) { + if (_session->abort_empty_reversible_command ()) { + return; + } RangeSelectionAfterSplit rsas = Config->get_range_selection_after_split();