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,