From e78bc71851739e6f039db688bd5c255167d4f02f Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 26 Jul 2011 13:42:34 +0200 Subject: [PATCH] Fix crash when replying macro including alt+r Task-number: QTCREATORBUG-5331 Change-Id: Ice1b9d0bdd153e437e5a70b208947b6db98cc1e3 Reviewed-on: http://codereview.qt.nokia.com/2189 Reviewed-by: Qt Sanity Bot Reviewed-by: Eike Ziller --- src/plugins/macros/macromanager.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/plugins/macros/macromanager.cpp b/src/plugins/macros/macromanager.cpp index 57b99e5173a..6f799818ab9 100644 --- a/src/plugins/macros/macromanager.cpp +++ b/src/plugins/macros/macromanager.cpp @@ -323,8 +323,22 @@ void MacroManager::endMacro() void MacroManager::executeLastMacro() { - if (d->currentMacro) - d->executeMacro(d->currentMacro); + if (!d->currentMacro) + return; + + // make sure the macro doesn't accidentally invoke a macro action + Core::ActionManager *am = Core::ICore::instance()->actionManager(); + am->command(Constants::START_MACRO)->action()->setEnabled(false); + am->command(Constants::END_MACRO)->action()->setEnabled(false); + am->command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(false); + am->command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(false); + + d->executeMacro(d->currentMacro); + + am->command(Constants::START_MACRO)->action()->setEnabled(true); + am->command(Constants::END_MACRO)->action()->setEnabled(false); + am->command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(true); + am->command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(true); } bool MacroManager::executeMacro(const QString &name)