Fix deadlock when opening settings window

This commit is contained in:
WarmUpTill 2025-12-28 20:32:12 +01:00 committed by WarmUpTill
parent faf52c38bb
commit 74a9681c8e

View File

@ -261,6 +261,14 @@ std::optional<std::string> 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,