Fix for freeze on scene collection change

This commit is contained in:
WarmUpTill 2017-02-17 17:16:43 +01:00 committed by GitHub
parent 279f62aaec
commit e0399e732d

View File

@ -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;
}
}