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..
This commit is contained in:
Robin Gareus 2021-04-29 21:14:23 +02:00
parent a8c47da364
commit 2c64736604
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
1 changed files with 6 additions and 5 deletions

View File

@ -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<AudioRange> 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<Command*> 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 ();
}
}