Fix crash while running macro actions

Users could invalidate the actions vector while the actions were
executed resulting in a crash.
This commit is contained in:
WarmUpTill
2023-11-20 19:31:27 +01:00
committed by WarmUpTill
parent b0cb52fe90
commit d4c7b0e455

View File

@@ -276,9 +276,13 @@ void Macro::ResetTimers()
}
bool Macro::RunActionsHelper(
const std::deque<std::shared_ptr<MacroAction>> &actions,
const std::deque<std::shared_ptr<MacroAction>> &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()) {