According to MSDN PeekMessage returns false only when the message queue is empty. If there is another message after WM_QUIT, the part of the code responsible for proper closing of the application would never be triggered. This change handles WM_QUIT message properly.

This commit is contained in:
asokolow 2017-06-27 09:00:14 +02:00
parent 13d6076a5f
commit 0cef15c0f2

View file

@ -216,7 +216,8 @@ void VulkanExampleBase::renderLoop()
destHeight = height;
#if defined(_WIN32)
MSG msg;
while (TRUE)
bool quitMessageReceived = false;
while (!quitMessageReceived)
{
auto tStart = std::chrono::high_resolution_clock::now();
if (viewUpdated)
@ -229,11 +230,12 @@ void VulkanExampleBase::renderLoop()
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
if (msg.message == WM_QUIT)
{
quitMessageReceived = true;
break;
}
}
render();