[Exception] Don't deadlock trying to close the window
This commit is contained in:
parent
f7a337f04c
commit
d6a674b883
@ -35,7 +35,7 @@ namespace Assets
|
|||||||
{
|
{
|
||||||
buffer->align(Utils::Stream::ALIGN_4);
|
buffer->align(Utils::Stream::ALIGN_4);
|
||||||
|
|
||||||
// not sure if this is neede but both brushside and brushedge need it and it can't hurt
|
// not sure if this is needed but both brushside and brushedge need it and it can't hurt
|
||||||
for (int i = 0; i < asset->numCPlanes; ++i)
|
for (int i = 0; i < asset->numCPlanes; ++i)
|
||||||
{
|
{
|
||||||
builder->storePointer(&asset->cPlanes[i]);
|
builder->storePointer(&asset->cPlanes[i]);
|
||||||
|
@ -25,6 +25,12 @@ namespace Components
|
|||||||
{
|
{
|
||||||
FreeConsole();
|
FreeConsole();
|
||||||
|
|
||||||
|
if(IsWindow(Console::GetWindow()) != FALSE)
|
||||||
|
{
|
||||||
|
CloseWindow(Console::GetWindow());
|
||||||
|
DestroyWindow(Console::GetWindow());
|
||||||
|
}
|
||||||
|
|
||||||
if (IsWindow(Window::GetWindow()) != FALSE)
|
if (IsWindow(Window::GetWindow()) != FALSE)
|
||||||
{
|
{
|
||||||
CloseWindow(Window::GetWindow());
|
CloseWindow(Window::GetWindow());
|
||||||
@ -34,11 +40,17 @@ namespace Components
|
|||||||
|
|
||||||
// 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 && GetMessage(&msg, nullptr, NULL, NULL))
|
Utils::Time::Interval interval;
|
||||||
|
while (IsWindow(Window::GetWindow()) != FALSE && !interval.elapsed(2s))
|
||||||
|
{
|
||||||
|
if (PeekMessage(&msg, nullptr, NULL, NULL, PM_REMOVE))
|
||||||
{
|
{
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::this_thread::sleep_for(10ms);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This only suspends the main game threads, which is enough for us
|
// This only suspends the main game threads, which is enough for us
|
||||||
|
Loading…
Reference in New Issue
Block a user