Fix freeze when changing scene collection

This commit is contained in:
WarmUpTill 2022-11-16 14:49:13 +01:00 committed by WarmUpTill
parent 9bcced524b
commit 624ff9f5c6
3 changed files with 19 additions and 1 deletions

View File

@ -601,6 +601,17 @@ void handleExit()
FreeSceneSwitcher();
}
void handleSceneCollectionChanging()
{
if (switcher->settingsWindowOpened) {
AdvSceneSwitcher::window->close();
}
if (!switcher->stop) {
switcher->sceneColletionStop = true;
switcher->Stop();
}
}
// Note to future self:
// be careful using switcher->m here as there is potential for deadlocks when using
// frontend functions such as obs_frontend_set_current_scene()
@ -646,6 +657,11 @@ static void OBSEvent(enum obs_frontend_event event, void *switcher)
case OBS_FRONTEND_EVENT_STREAMING_STOPPING:
setStreamStopping();
break;
#if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(27, 2, 0)
case OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGING:
handleSceneCollectionChanging();
break;
#endif
default:
break;
}

View File

@ -607,7 +607,8 @@ void SwitcherData::saveGeneralSettings(obs_data_t *obj)
cooldown.Save(obj, "cooldown", "cooldownUnit");
obs_data_set_bool(obj, "active", !stop);
obs_data_set_bool(obj, "active", sceneColletionStop ? true : !stop);
sceneColletionStop = false;
obs_data_set_int(obj, "startup_behavior", startupBehavior);
obs_data_set_int(obj, "autoStartEvent",

View File

@ -92,6 +92,7 @@ struct SwitcherData {
bool transitionActive = false;
bool waitForTransition = false;
bool stop = false;
bool sceneColletionStop = false;
bool verbose = false;
bool disableHints = false;
bool hideLegacyTabs = true;