From 74a9681c8ed3fd1e4e106c68b01c515bc849fbc1 Mon Sep 17 00:00:00 2001 From: WarmUpTill <19472752+WarmUpTill@users.noreply.github.com> Date: Sun, 28 Dec 2025 20:32:12 +0100 Subject: [PATCH] Fix deadlock when opening settings window --- lib/win/advanced-scene-switcher-win.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/win/advanced-scene-switcher-win.cpp b/lib/win/advanced-scene-switcher-win.cpp index e3ee0d07..e6b2c487 100644 --- a/lib/win/advanced-scene-switcher-win.cpp +++ b/lib/win/advanced-scene-switcher-win.cpp @@ -261,6 +261,14 @@ std::optional GetTextInWindow(const std::string &window) return {}; } + DWORD pid = 0; + DWORD thid = 0; + thid = GetWindowThreadProcessId(hwnd, &pid); + // Calling CoCreateInstance() on the OBS windows might cause a deadlock + if (GetCurrentProcessId() == pid) { + return {}; + } + IUIAutomation *automation = nullptr; auto hr = CoCreateInstance(__uuidof(CUIAutomation), nullptr, CLSCTX_INPROC_SERVER,