don't wait for Windows messages in WaitForThread() if we don't dispatch events (should fix the bugs 1523302 and 1650795)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@44346 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -755,15 +755,26 @@ wxThreadInternal::WaitForTerminate(wxCriticalSection& cs,
|
|||||||
#if !defined(QS_ALLPOSTMESSAGE)
|
#if !defined(QS_ALLPOSTMESSAGE)
|
||||||
#define QS_ALLPOSTMESSAGE 0
|
#define QS_ALLPOSTMESSAGE 0
|
||||||
#endif
|
#endif
|
||||||
|
if ( !wxEventLoop::GetActive() )
|
||||||
result = ::MsgWaitForMultipleObjects
|
{
|
||||||
(
|
// don't ask for Windows messages if we don't have a running event
|
||||||
1, // number of objects to wait for
|
// loop to process them as otherwise we'd enter an infinite loop
|
||||||
&m_hThread, // the objects
|
// with MsgWaitForMultipleObjects() always returning WAIT_OBJECT_0
|
||||||
false, // don't wait for all objects
|
// + 1 because the message would remain forever in the queue
|
||||||
INFINITE, // no timeout
|
result = ::WaitForSingleObject(&m_hThread, INFINITE);
|
||||||
QS_ALLINPUT|QS_ALLPOSTMESSAGE // return as soon as there are any events
|
}
|
||||||
);
|
else // wait for thread termination without blocking the GUI
|
||||||
|
{
|
||||||
|
result = ::MsgWaitForMultipleObjects
|
||||||
|
(
|
||||||
|
1, // number of objects to wait for
|
||||||
|
&m_hThread, // the objects
|
||||||
|
false, // don't wait for all objects
|
||||||
|
INFINITE, // no timeout
|
||||||
|
QS_ALLINPUT | // return as soon as there are any events
|
||||||
|
QS_ALLPOSTMESSAGE
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
switch ( result )
|
switch ( result )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user