mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-09-08 09:36:07 -05:00
resolve potential deadlocks (#66)
A deadlock could occur if the save callback is called just before the frontend set functions are used. Thus unlock() is necessary before setting current scene or transition. (e.g. if start recording is activated just before using the above functions, as this apparently triggers a save() call)
This commit is contained in:
@@ -143,9 +143,10 @@ void AdvSceneSwitcher::on_defaultTransitionsDown_clicked()
|
||||
switcher->defaultSceneTransitions[index + 1]);
|
||||
}
|
||||
|
||||
void SwitcherData::setDefaultSceneTransitions()
|
||||
void SwitcherData::checkDefaultSceneTransitions(bool &match,
|
||||
OBSWeakSource &transition)
|
||||
{
|
||||
if (changedDefTransitionRecently)
|
||||
if (checkedDefTransition)
|
||||
return;
|
||||
|
||||
obs_source_t *currentSource = obs_frontend_get_current_scene();
|
||||
@@ -156,22 +157,25 @@ void SwitcherData::setDefaultSceneTransitions()
|
||||
if (!s.initialized())
|
||||
continue;
|
||||
|
||||
obs_source_t *transition =
|
||||
obs_weak_source_get_source(s.transition);
|
||||
//This might cancel the current transition
|
||||
//There is no way to be sure when the previous transition finished
|
||||
obs_frontend_set_current_transition(transition);
|
||||
match = true;
|
||||
transition = s.transition;
|
||||
|
||||
if (verbose)
|
||||
s.logMatch();
|
||||
|
||||
obs_source_release(transition);
|
||||
break;
|
||||
}
|
||||
}
|
||||
obs_source_release(currentSource);
|
||||
obs_weak_source_release(ws);
|
||||
changedDefTransitionRecently = true;
|
||||
|
||||
checkedDefTransition = true;
|
||||
}
|
||||
|
||||
void SwitcherData::setCurrentDefTransition(OBSWeakSource &transition)
|
||||
{
|
||||
obs_source_t *transitionSource = obs_weak_source_get_source(transition);
|
||||
obs_frontend_set_current_transition(transitionSource);
|
||||
obs_source_release(transitionSource);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_transitionOverridecheckBox_stateChanged(int state)
|
||||
|
||||
Reference in New Issue
Block a user