From abbe9276f0b0784c9e2475fef9deaad0accab932 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Thu, 24 Nov 2016 17:17:37 -0500 Subject: [PATCH] Exception safety in: CommandManager --- src/commands/CommandManager.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/commands/CommandManager.cpp b/src/commands/CommandManager.cpp index 152b18dc7..25d688bb8 100644 --- a/src/commands/CommandManager.cpp +++ b/src/commands/CommandManager.cpp @@ -1127,10 +1127,9 @@ bool CommandManager::FilterKeyEvent(AudacityProject *project, const wxKeyEvent & // rest of the command handling. But, to use the common handler, we // enable them temporarily and then disable them again after handling. // LL: Why do they need to be disabled??? - entry->enabled = true; - bool ret = HandleCommandEntry(entry, NoFlagsSpecifed, NoFlagsSpecifed, &evt); entry->enabled = false; - return ret; + auto cleanup = valueRestorer( entry->enabled, true ); + return HandleCommandEntry(entry, NoFlagsSpecifed, NoFlagsSpecifed, &evt); } // Any other keypresses must be destined for this project window.