fix HasPendingEvents() to only return true if there are actually events pending
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47463 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -330,16 +330,13 @@ bool wxAppConsoleBase::Dispatch()
|
|||||||
|
|
||||||
bool wxAppConsoleBase::HasPendingEvents() const
|
bool wxAppConsoleBase::HasPendingEvents() const
|
||||||
{
|
{
|
||||||
// ensure that we're the only thread to modify the pending events list
|
|
||||||
wxENTER_CRIT_SECT( *wxPendingEventsLocker );
|
wxENTER_CRIT_SECT( *wxPendingEventsLocker );
|
||||||
|
|
||||||
if ( !wxPendingEvents )
|
bool has = wxPendingEvents && !wxPendingEvents->IsEmpty();
|
||||||
{
|
|
||||||
wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
|
wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
|
||||||
return false;
|
|
||||||
}
|
return has;
|
||||||
wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
@@ -357,11 +354,10 @@ void wxAppConsoleBase::ProcessPendingEvents()
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( !HasPendingEvents() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
wxENTER_CRIT_SECT( *wxPendingEventsLocker );
|
wxENTER_CRIT_SECT( *wxPendingEventsLocker );
|
||||||
|
|
||||||
|
if (wxPendingEvents)
|
||||||
|
{
|
||||||
// iterate until the list becomes empty
|
// iterate until the list becomes empty
|
||||||
wxList::compatibility_iterator node = wxPendingEvents->GetFirst();
|
wxList::compatibility_iterator node = wxPendingEvents->GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -379,6 +375,7 @@ void wxAppConsoleBase::ProcessPendingEvents()
|
|||||||
|
|
||||||
node = wxPendingEvents->GetFirst();
|
node = wxPendingEvents->GetFirst();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
|
wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user