Create a trap for overlapping or nested undo commands

This commit is contained in:
Ben Loftis 2022-05-03 07:57:20 -05:00
parent 9c9273e694
commit c44d692390
1 changed files with 8 additions and 0 deletions

View File

@ -3161,6 +3161,14 @@ Session::begin_reversible_command (const string& name)
void
Session::begin_reversible_command (GQuark q)
{
if (_current_trans) {
cerr << "An UNDO transaction was started while a prior command was underway. Aborting command (" << g_quark_to_string (q) << ") and prior (" << _current_trans->name() << ")" << endl;
PBD::warning << "An UNDO transaction was started while a prior command was underway. Aborting command (" << g_quark_to_string (q) << ") and prior (" << _current_trans->name() << ")" << endmsg;
abort_reversible_command();
assert (false);
return;
}
/* If nested begin/commit pairs are used, we create just one UndoTransaction
to hold all the commands that are committed. This keeps the order of
commands correct in the history.