13
0

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.
This commit is contained in:
Robin Gareus 2021-03-10 13:55:32 +01:00
parent 9fb21a0905
commit bdc1cdc15f
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -3190,6 +3190,11 @@ Editor::separate_regions_between (const TimeSelection& ts)
for (list<AudioRange>::const_iterator t = ts.begin(); t != ts.end(); ++t) { for (list<AudioRange>::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::connection c = rtv->view()->RegionViewAdded.connect (
sigc::mem_fun(*this, &Editor::collect_new_region_view)); 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), sigc::ptr_fun (add_if_covered),
&(*t), &new_selection)); &(*t), &new_selection));
if (!in_command) {
begin_reversible_command (_("separate"));
in_command = true;
}
/* pick up changes to existing regions */ /* pick up changes to existing regions */
vector<Command*> cmds; vector<Command*> cmds;
playlist->rdiff (cmds); playlist->rdiff (cmds);
_session->add_commands (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)); _session->add_command(new StatefulDiffCommand (playlist));
} }
@ -3226,6 +3225,9 @@ Editor::separate_regions_between (const TimeSelection& ts)
} }
if (in_command) { if (in_command) {
if (_session->abort_empty_reversible_command ()) {
return;
}
RangeSelectionAfterSplit rsas = Config->get_range_selection_after_split(); RangeSelectionAfterSplit rsas = Config->get_range_selection_after_split();