From dd5bcf425a0f455c84ec3d58378fd6404a593a66 Mon Sep 17 00:00:00 2001 From: WarmUpTill <19472752+WarmUpTill@users.noreply.github.com> Date: Tue, 23 Sep 2025 17:55:33 +0200 Subject: [PATCH] Fix freeze on shutdown Recording / streaming start event might be stuck in event queue if advanced scene switcher or OBS takes a while to shut down. This could result in the plugin starting back up while OBS is attempting to shut down resulting in a potential deadlock during shutdown. --- lib/advanced-scene-switcher.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/advanced-scene-switcher.cpp b/lib/advanced-scene-switcher.cpp index 48bd4af6..26f6f9a6 100644 --- a/lib/advanced-scene-switcher.cpp +++ b/lib/advanced-scene-switcher.cpp @@ -552,18 +552,28 @@ static void resetLiveTime() static void checkAutoStartRecording() { + if (switcher->obsIsShuttingDown) { + return; + } + if (switcher->autoStartEvent == SwitcherData::AutoStart::RECORDING || switcher->autoStartEvent == - SwitcherData::AutoStart::RECORINDG_OR_STREAMING) + SwitcherData::AutoStart::RECORINDG_OR_STREAMING) { switcher->Start(); + } } static void checkAutoStartStreaming() { + if (switcher->obsIsShuttingDown) { + return; + } + if (switcher->autoStartEvent == SwitcherData::AutoStart::STREAMING || switcher->autoStartEvent == - SwitcherData::AutoStart::RECORINDG_OR_STREAMING) + SwitcherData::AutoStart::RECORINDG_OR_STREAMING) { switcher->Start(); + } } static void handleTransitionEnd()