From 686ecd1557b70580e32bff82600334ae26e81c4a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 25 Jun 2006 23:53:53 +0000 Subject: [PATCH] avoid infinite loop in AlwaysYield() if we somehow got WM_PAINT in the queue (patch 1501682) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39831 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/basemsw.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/msw/basemsw.cpp b/src/msw/basemsw.cpp index 3dae6042c7..033d3a76b2 100644 --- a/src/msw/basemsw.cpp +++ b/src/msw/basemsw.cpp @@ -41,9 +41,17 @@ void wxConsoleAppTraits::AlwaysYield() { + // we need to use special logic to deal with WM_PAINT: as this pseudo + // message is generated automatically as long as there are invalidated + // windows belonging to this thread, we'd never return if we waited here + // until we have no more of them left. OTOH, this message is always the + // last one in the queue, so we can safely return as soon as we detect it MSG msg; while ( ::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) - ; + { + if ( msg.message == WM_PAINT ) + break; + } } void *wxConsoleAppTraits::BeforeChildWaitLoop() -- 2.47.2