[Exception] Fix process suspension

This commit is contained in:
momo5502 2017-02-10 19:45:31 +01:00
parent 14601ebd03
commit e72a60c19e

View File

@ -19,16 +19,21 @@ namespace Components
{ {
FreeConsole(); FreeConsole();
if (IsWindow(Console::GetWindow()) != FALSE) DestroyWindow(Console::GetWindow()); if (IsWindow(Window::GetWindow()) != FALSE)
if (IsWindow(Window::GetWindow()) != FALSE) DestroyWindow(Window::GetWindow()); {
CloseWindow(Window::GetWindow());
DestroyWindow(Window::GetWindow());
std::this_thread::sleep_for(2s);
// This makes sure we either destroy the windows or wait till they are destroyed // This makes sure we either destroy the windows or wait till they are destroyed
MSG msg; MSG msg;
while ((IsWindow(Window::GetWindow()) != FALSE || IsWindow(Console::GetWindow()) != FALSE) && GetMessage(&msg, nullptr, NULL, NULL)) while (IsWindow(Window::GetWindow()) != FALSE && GetMessage(&msg, nullptr, NULL, NULL))
{ {
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
} }
}
// This only suspends the main game threads, which is enough for us // This only suspends the main game threads, which is enough for us
Game::Sys_SuspendOtherThreads(); Game::Sys_SuspendOtherThreads();