Fix crash on shutdown

StopAllMacros was called before th->wait(), allowing Macro::Stop()
to run concurrently with the other threads still inside
CheckConditions. This caused races on _conditionCheckFuture (called
from both threads) and _helperThreads.

This could happen if conditions / actions were marked to run in parallel
to the main loop.
This commit is contained in:
WarmUpTill
2026-05-28 17:36:28 +02:00
committed by WarmUpTill
parent 9911c41a35
commit f9f26ad50b
4 changed files with 14 additions and 4 deletions

View File

@@ -1316,7 +1316,14 @@ bool RunMacros()
return true;
}
void StopAllMacros()
void SignalStopAllMacros()
{
for (const auto &m : GetAllMacros()) {
m->SignalStop();
}
}
void WaitForAllMacros()
{
for (const auto &m : GetAllMacros()) {
m->Stop();