1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +02:00

Commit 51b3b0f - minor update

Using init capture removes any danger of using the wrong value of MacroReentryCount
This commit is contained in:
David Bailes 2020-07-04 12:56:42 +01:00
parent 51b3b0f19a
commit a415c3fe38

View File

@ -969,10 +969,8 @@ bool MacroCommands::ApplyMacro(
}
// Upon exit of the top level apply, roll back the state if an error occurs.
// This code relies on cleanup2 being defined after cleanup1, so that its
// destructor is run before cleanup1's destructor.
auto cleanup2 = finally([&] {
if (MacroReentryCount == 1 && !res && proj) {
auto cleanup2 = finally([&, macroReentryCount = MacroReentryCount] {
if (macroReentryCount == 1 && !res && proj) {
// Macro failed or was cancelled; revert to the previous state
ProjectHistory::Get(*proj).RollbackState();
}