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:
WarmUpTill
2020-11-21 01:40:24 +01:00
committed by GitHub
parent 4f6275619a
commit f6c3c65e26
4 changed files with 55 additions and 33 deletions

View File

@@ -99,7 +99,7 @@ struct SwitcherData {
std::deque<SceneTransition> sceneTransitions;
std::deque<DefaultSceneTransition> defaultSceneTransitions;
bool changedDefTransitionRecently = false;
bool checkedDefTransition = false;
std::deque<MediaSwitch> mediaSwitches;
@@ -154,10 +154,12 @@ struct SwitcherData {
bool sceneChangedDuringWait();
bool prioFuncsValid();
void writeSceneInfoToFile();
void setDefaultSceneTransitions();
void autoStopStreamAndRecording();
void autoStartStreamRecording();
bool checkPause();
void checkDefaultSceneTransitions(bool &match,
OBSWeakSource &transition);
void setCurrentDefTransition(OBSWeakSource &transition);
void checkSceneSequence(bool &match, OBSWeakSource &scene,
OBSWeakSource &transition,
std::unique_lock<std::mutex> &lock);