]> git.saurik.com Git - wxWidgets.git/commitdiff
avoid infinite loop in AlwaysYield() if we somehow got WM_PAINT in the queue (patch...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 25 Jun 2006 23:53:53 +0000 (23:53 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 25 Jun 2006 23:53:53 +0000 (23:53 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39831 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/basemsw.cpp

index 3dae6042c7a3fdd6ea09572d6b3948523f22f86b..033d3a76b2a5051d559f74acbcf214aea7b5a58a 100644 (file)
 
 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()