1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-08 16:11:14 +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) { switch (iTimerRecordingOutcome) {
case POST_TIMER_RECORD_CANCEL_WAIT: case POST_TIMER_RECORD_CANCEL_WAIT:
// Canceled on the wait dialog // Canceled on the wait dialog
if (GetUndoManager()->UndoAvailable()) { RollbackState();
// MY: We need to roll back what changes we have made here break;
OnUndo();
}
break;
case POST_TIMER_RECORD_CANCEL: case POST_TIMER_RECORD_CANCEL:
// RunWaitDialog() shows the "wait for start" as well as "recording" dialog // 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. // 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. // which is blocked by this function.
// so instead we mark a flag to undo it there. // so instead we mark a flag to undo it there.
mTimerRecordCanceled = true; mTimerRecordCanceled = true;
break; break;
case POST_TIMER_RECORD_NOTHING: case POST_TIMER_RECORD_NOTHING:
// No action required // No action required
break; break;
case POST_TIMER_RECORD_CLOSE: case POST_TIMER_RECORD_CLOSE:
// Quit Audacity // Quit Audacity
exit(0); exit(0);
break; break;
case POST_TIMER_RECORD_RESTART: case POST_TIMER_RECORD_RESTART:
// Restart System // Restart System
#ifdef __WINDOWS__ #ifdef __WINDOWS__
system("shutdown /r /f /t 30"); system("shutdown /r /f /t 30");
#endif #endif
break; break;
case POST_TIMER_RECORD_SHUTDOWN: case POST_TIMER_RECORD_SHUTDOWN:
// Shutdown System // Shutdown System
#ifdef __WINDOWS__ #ifdef __WINDOWS__
system("shutdown /s /f /t 30"); system("shutdown /s /f /t 30");
#endif #endif
break; break;
} }
} }
} }