From 0cef15c0f237fec831f74132aa7413bcab2381ea Mon Sep 17 00:00:00 2001 From: asokolow Date: Tue, 27 Jun 2017 09:00:14 +0200 Subject: [PATCH] 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. --- base/vulkanexamplebase.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/base/vulkanexamplebase.cpp b/base/vulkanexamplebase.cpp index 7061dfb0..636f46b3 100644 --- a/base/vulkanexamplebase.cpp +++ b/base/vulkanexamplebase.cpp @@ -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) - { - break; + if (msg.message == WM_QUIT) + { + quitMessageReceived = true; + break; + } } render();