changed DoMessageFromThreadWait() to not block if there are no messages, this avoids the need for sending a dummy WM_NULL from the thread wait loop (replaces patch 1459812)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38628 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
284ee6c3da
commit
031943ac4c
@ -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();
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user