]> git.saurik.com Git - wxWidgets.git/commitdiff
changed DoMessageFromThreadWait() to not block if there are no messages, this avoids...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 8 Apr 2006 22:51:42 +0000 (22:51 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 8 Apr 2006 22:51:42 +0000 (22:51 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38628 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/app.cpp
src/msw/thread.cpp

index e071002e1b367d504f389511d9453c8e846cc2d2..e7733b748c73dd2b5a3688b72d95213d0788904c 100644 (file)
@@ -48,6 +48,7 @@
 #include "wx/filename.h"
 #include "wx/module.h"
 #include "wx/dynlib.h"
+#include "wx/evtloop.h"
 
 #include "wx/msw/private.h"
 #include "wx/msw/ole/oleutils.h"
@@ -218,7 +219,14 @@ bool wxGUIAppTraits::DoMessageFromThreadWait()
 {
     // we should return false only if the app should exit, i.e. only if
     // Dispatch() determines that the main event loop should terminate
-    return !wxTheApp || wxTheApp->Dispatch();
+    wxEventLoop *evtLoop = wxEventLoop::GetActive();
+    if ( !evtLoop || !evtLoop->Pending() )
+    {
+        // no events means no quit event
+        return true;
+    }
+
+    return evtLoop->Dispatch();
 }
 
 wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo()
@@ -748,8 +756,6 @@ terminate the program,\r\n\
 
 #if WXWIN_COMPATIBILITY_2_4
 
-#include "wx/evtloop.h"
-
 void wxApp::DoMessage(WXMSG *pMsg)
 {
     wxEventLoop *evtLoop = wxEventLoop::GetActive();
index 30484e2c86debec6b7df855ac32cc054ffcfc4dc..23960ebf94e3784253de58dc21ddc1b681dc0436 100644 (file)
@@ -737,12 +737,6 @@ wxThreadInternal::WaitForTerminate(wxCriticalSection& cs,
                 //     the system might dead lock then
                 if ( wxThread::IsMain() )
                 {
-                    // it looks that sometimes WAIT_OBJECT_0 + 1 is
-                    // returned but there are no messages in the thread
-                    // queue -- prevent DoMessageFromThreadWait() from
-                    // blocking inside ::GetMessage() forever in this case
-                    ::PostMessage(NULL, WM_NULL, 0, 0);
-
                     wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits()
                                                    : NULL;