Fix crash when switching scene collection during macro wait

Also update comment stating why the main mutex needs to be unlocked
during the "action" phase of running macros
This commit is contained in:
WarmUpTill 2021-10-19 21:26:22 +02:00 committed by WarmUpTill
parent b786831f3b
commit 8ff50056f0
2 changed files with 8 additions and 3 deletions

View File

@ -232,12 +232,17 @@ void SwitcherData::Thread()
}
}
// After this point we will call frontend functions
// After this point we will call frontend functions like
// obs_frontend_set_current_scene() and
// obs_frontend_set_current_transition()
//
// During this time SaveSceneSwitcher() could be called
// leading to a deadlock, so we have to unlock()
// leading to a deadlock with the frontend function being stuck
// in QMetaObject::invokeMethod() holding the mutex and
// OBS being stuck in SaveSceneSwitcher().
//
// So we have to unlock() risking race conditions as these are
// less frequent than the above described deadlock
lock.unlock();
if (match) {

View File

@ -492,7 +492,7 @@ bool SwitcherData::checkMacros()
bool SwitcherData::runMacros()
{
for (auto &m : macros) {
for (auto m : macros) {
if (m.Matched()) {
vblog(LOG_INFO, "running macro: %s", m.Name().c_str());
if (!m.PerformAction()) {