From 6d086dcc23acb9a87c9971db3790244745fc8867 Mon Sep 17 00:00:00 2001 From: James Crook Date: Mon, 21 Nov 2016 12:30:23 +0000 Subject: [PATCH] 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. --- src/Menus.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/Menus.cpp b/src/Menus.cpp index bb6b8e402..c0a625168 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -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; } } }