From e72a60c19e872d8ca239c1b930d8c837af832ea8 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Fri, 10 Feb 2017 19:45:31 +0100 Subject: [PATCH] [Exception] Fix process suspension --- src/Components/Modules/Exception.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Components/Modules/Exception.cpp b/src/Components/Modules/Exception.cpp index 6826babb..9f83aee3 100644 --- a/src/Components/Modules/Exception.cpp +++ b/src/Components/Modules/Exception.cpp @@ -19,15 +19,20 @@ namespace Components { FreeConsole(); - if (IsWindow(Console::GetWindow()) != FALSE) DestroyWindow(Console::GetWindow()); - if (IsWindow(Window::GetWindow()) != FALSE) DestroyWindow(Window::GetWindow()); - - // This makes sure we either destroy the windows or wait till they are destroyed - MSG msg; - while ((IsWindow(Window::GetWindow()) != FALSE || IsWindow(Console::GetWindow()) != FALSE) && GetMessage(&msg, nullptr, NULL, NULL)) + if (IsWindow(Window::GetWindow()) != FALSE) { - TranslateMessage(&msg); - DispatchMessage(&msg); + 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 + MSG msg; + while (IsWindow(Window::GetWindow()) != FALSE && GetMessage(&msg, nullptr, NULL, NULL)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } } // This only suspends the main game threads, which is enough for us