correctly abort the undo record when Editor::clear_markers (et al) have no effect
* move abort_reversible_command into the correct bracketed location * check for missing _session at top of function to avoid unnecessary nesting * this fixes an undo 'assert' when an action like "clear xrun markers" has no effect * this was likely a copy+paste thinko since they are adjacent in the code
This commit is contained in:
parent
dbd80a6dd0
commit
256549e0c7
|
@ -2509,15 +2509,17 @@ Editor::set_mark ()
|
||||||
void
|
void
|
||||||
Editor::clear_markers ()
|
Editor::clear_markers ()
|
||||||
{
|
{
|
||||||
if (_session) {
|
if (!_session) {
|
||||||
begin_reversible_command (_("clear markers"));
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
XMLNode &before = _session->locations()->get_state();
|
begin_reversible_command (_("clear markers"));
|
||||||
if (_session->locations()->clear_markers ()) {
|
|
||||||
XMLNode &after = _session->locations()->get_state();
|
XMLNode &before = _session->locations()->get_state();
|
||||||
_session->add_command(new MementoCommand<Locations>(*(_session->locations()), &before, &after));
|
if (_session->locations()->clear_markers ()) {
|
||||||
commit_reversible_command ();
|
XMLNode &after = _session->locations()->get_state();
|
||||||
}
|
_session->add_command(new MementoCommand<Locations>(*(_session->locations()), &before, &after));
|
||||||
|
commit_reversible_command ();
|
||||||
} else {
|
} else {
|
||||||
abort_reversible_command ();
|
abort_reversible_command ();
|
||||||
}
|
}
|
||||||
|
@ -2526,16 +2528,18 @@ Editor::clear_markers ()
|
||||||
void
|
void
|
||||||
Editor::clear_xrun_markers ()
|
Editor::clear_xrun_markers ()
|
||||||
{
|
{
|
||||||
if (_session) {
|
if (!_session) {
|
||||||
begin_reversible_command (_("clear xrun markers"));
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
XMLNode &before = _session->locations()->get_state();
|
begin_reversible_command (_("clear xrun markers"));
|
||||||
if (_session->locations()->clear_xrun_markers ()) {
|
|
||||||
XMLNode &after = _session->locations()->get_state();
|
|
||||||
_session->add_command(new MementoCommand<Locations>(*(_session->locations()), &before, &after));
|
|
||||||
|
|
||||||
commit_reversible_command ();
|
XMLNode &before = _session->locations()->get_state();
|
||||||
}
|
if (_session->locations()->clear_xrun_markers ()) {
|
||||||
|
XMLNode &after = _session->locations()->get_state();
|
||||||
|
_session->add_command(new MementoCommand<Locations>(*(_session->locations()), &before, &after));
|
||||||
|
|
||||||
|
commit_reversible_command ();
|
||||||
} else {
|
} else {
|
||||||
abort_reversible_command ();
|
abort_reversible_command ();
|
||||||
}
|
}
|
||||||
|
@ -2544,18 +2548,20 @@ Editor::clear_xrun_markers ()
|
||||||
void
|
void
|
||||||
Editor::clear_ranges ()
|
Editor::clear_ranges ()
|
||||||
{
|
{
|
||||||
if (_session) {
|
if (!_session) {
|
||||||
begin_reversible_command (_("clear ranges"));
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
XMLNode &before = _session->locations()->get_state();
|
begin_reversible_command (_("clear ranges"));
|
||||||
|
|
||||||
if (_session->locations()->clear_ranges ()) {
|
XMLNode &before = _session->locations()->get_state();
|
||||||
|
|
||||||
XMLNode &after = _session->locations()->get_state();
|
if (_session->locations()->clear_ranges ()) {
|
||||||
_session->add_command(new MementoCommand<Locations>(*(_session->locations()), &before, &after));
|
|
||||||
|
|
||||||
commit_reversible_command ();
|
XMLNode &after = _session->locations()->get_state();
|
||||||
}
|
_session->add_command(new MementoCommand<Locations>(*(_session->locations()), &before, &after));
|
||||||
|
|
||||||
|
commit_reversible_command ();
|
||||||
} else {
|
} else {
|
||||||
abort_reversible_command ();
|
abort_reversible_command ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue