1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-08 08:01:19 +02:00

Fix TimerRecord overenthusiastic undo.

Thanks to Pual Licameli for finding the bug and its cause.
A cancelled TimerRecord would undo the previous action rather than just roll back.
This commit is contained in:
James Crook 2016-11-21 12:30:23 +00:00
parent fa4f3c6bb6
commit 6d086dcc23

View File

@ -6570,11 +6570,8 @@ void AudacityProject::OnTimerRecord()
switch (iTimerRecordingOutcome) {
case POST_TIMER_RECORD_CANCEL_WAIT:
// Canceled on the wait dialog
if (GetUndoManager()->UndoAvailable()) {
// MY: We need to roll back what changes we have made here
OnUndo();
}
break;
RollbackState();
break;
case POST_TIMER_RECORD_CANCEL:
// RunWaitDialog() shows the "wait for start" as well as "recording" dialog
// if it returned POST_TIMER_RECORD_CANCEL it means the user cancelled while the recording, so throw out the fresh track.
@ -6582,26 +6579,26 @@ void AudacityProject::OnTimerRecord()
// which is blocked by this function.
// so instead we mark a flag to undo it there.
mTimerRecordCanceled = true;
break;
break;
case POST_TIMER_RECORD_NOTHING:
// No action required
break;
break;
case POST_TIMER_RECORD_CLOSE:
// Quit Audacity
exit(0);
break;
break;
case POST_TIMER_RECORD_RESTART:
// Restart System
#ifdef __WINDOWS__
system("shutdown /r /f /t 30");
#endif
break;
break;
case POST_TIMER_RECORD_SHUTDOWN:
// Shutdown System
#ifdef __WINDOWS__
system("shutdown /s /f /t 30");
#endif
break;
break;
}
}
}