don't assert if MsgWaitForMultipleObjects() returns WAIT_OBJECT_0 but there are no messages in the queue -- this does happen
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57660 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -111,22 +111,33 @@ int wxMSWEventLoopBase::GetNextMessageTimeout(WXMSG *msg, unsigned long timeout)
|
|||||||
{
|
{
|
||||||
// we use this function just in order to not block longer than the
|
// we use this function just in order to not block longer than the
|
||||||
// given timeout, so we don't pass any handles to it at all
|
// given timeout, so we don't pass any handles to it at all
|
||||||
if ( ::MsgWaitForMultipleObjects
|
DWORD rc = ::MsgWaitForMultipleObjects
|
||||||
(
|
(
|
||||||
0, NULL,
|
0, NULL,
|
||||||
FALSE,
|
FALSE,
|
||||||
timeout,
|
timeout,
|
||||||
QS_ALLINPUT
|
QS_ALLINPUT
|
||||||
) == WAIT_TIMEOUT )
|
);
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !::PeekMessage(msg, 0, 0, 0, PM_REMOVE) )
|
switch ( rc )
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( _T("PeekMessage() should have succeeded") );
|
default:
|
||||||
|
wxLogDebug("unexpected MsgWaitForMultipleObjects() return "
|
||||||
|
"value %lu", rc);
|
||||||
|
// fall through
|
||||||
|
|
||||||
return -1;
|
case WAIT_TIMEOUT:
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
case WAIT_OBJECT_0:
|
||||||
|
if ( !::PeekMessage(msg, 0, 0, 0, PM_REMOVE) )
|
||||||
|
{
|
||||||
|
// somehow it may happen that MsgWaitForMultipleObjects()
|
||||||
|
// returns true but there are no messages -- just treat it
|
||||||
|
// the same as timeout then
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user