mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-06-20 11:33:28 -05:00
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:
parent
9911c41a35
commit
f9f26ad50b
|
|
@ -461,12 +461,13 @@ void SwitcherData::Stop()
|
|||
SetMacroAbortWait(true);
|
||||
GetMacroWaitCV().notify_all();
|
||||
GetMacroTransitionCV().notify_all();
|
||||
StopAllMacros();
|
||||
SignalStopAllMacros();
|
||||
StopAndClearAllActionQueues();
|
||||
CloseAllInputDialogs();
|
||||
th->wait();
|
||||
delete th;
|
||||
th = nullptr;
|
||||
WaitForAllMacros();
|
||||
RunStopSteps();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,8 @@ EXPORT bool RunMacroElseActions(Macro *, bool forceParallel = false,
|
|||
bool ignorePause = false);
|
||||
EXPORT bool RunMacros();
|
||||
|
||||
void StopAllMacros();
|
||||
void SignalStopAllMacros();
|
||||
void WaitForAllMacros();
|
||||
|
||||
EXPORT void LoadMacros(obs_data_t *obj);
|
||||
EXPORT void SaveMacros(obs_data_t *obj);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ public:
|
|||
PauseStateSaveBehavior GetPauseStateSaveBehavior() const;
|
||||
|
||||
void Stop();
|
||||
void SignalStop() { _stop = true; }
|
||||
bool GetStop() const { return _stop; }
|
||||
void ResetTimers();
|
||||
|
||||
|
|
@ -228,7 +229,7 @@ void LoadMacros(obs_data_t *obj);
|
|||
void SaveMacros(obs_data_t *obj);
|
||||
bool CheckMacros();
|
||||
bool RunMacros();
|
||||
void StopAllMacros();
|
||||
void WaitForAllMacros();
|
||||
void InvalidateMacroTempVarValues();
|
||||
std::shared_ptr<Macro> GetMacroWithInvalidConditionInterval();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user