From d4c7b0e4559d3d7f9ff4895a3d4c9bf8dec2c9b7 Mon Sep 17 00:00:00 2001 From: WarmUpTill Date: Mon, 20 Nov 2023 19:31:27 +0100 Subject: [PATCH] Fix crash while running macro actions Users could invalidate the actions vector while the actions were executed resulting in a crash. --- src/macro-core/macro.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/macro-core/macro.cpp b/src/macro-core/macro.cpp index 445241f6..638ba510 100644 --- a/src/macro-core/macro.cpp +++ b/src/macro-core/macro.cpp @@ -276,9 +276,13 @@ void Macro::ResetTimers() } bool Macro::RunActionsHelper( - const std::deque> &actions, + const std::deque> &actionsToRun, bool ignorePause) { + // Create copy of action list as elements might be removed, inserted, or + // reordered while actions are currently being executed. + auto actions = actionsToRun; + bool actionsExecutedSuccessfully = true; for (auto &action : actions) { if (action->Enabled()) {