mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-07-02 00:22:10 -05:00
Fix for freeze on scene collection change
This commit is contained in:
parent
279f62aaec
commit
e0399e732d
|
|
@ -61,7 +61,16 @@ void GetWindowList(vector<string>& windows)
|
|||
void GetCurrentWindowTitle(string& title)
|
||||
{
|
||||
HWND window = GetForegroundWindow();
|
||||
//DWORD id;
|
||||
DWORD id;
|
||||
GetWindowThreadProcessId(window, &id);
|
||||
/*GetWindowText will freeze if the control it is reading was created in another thread.
|
||||
It does not directly read the control.Instead,
|
||||
it waits for the thread that created the control to process a WM_GETTEXT message.
|
||||
So if that thread is frozen in a WaitFor... call you have a deadlock.*/
|
||||
if (id == GetCurrentProcessId()) {
|
||||
title = "";
|
||||
return;
|
||||
}
|
||||
GetWindowTitle(window, title);
|
||||
}
|
||||
|
||||
|
|
@ -155,4 +164,4 @@ int getTime()
|
|||
int secondsSinceLastInput()
|
||||
{
|
||||
return (getTime() - getLastInputTime()) / 1000;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user