stop processing pending events after processing all of them which had been in the queue when we started, not until there are none as this could result in an infinite loop (part of patch 1080770)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30949 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-12-12 11:44:46 +00:00
parent 5767e83699
commit 18dbea4d81

View File

@@ -1106,6 +1106,9 @@ void wxEvtHandler::ProcessPendingEvents()
wxENTER_CRIT_SECT( *m_eventsLocker);
#endif
// remember last event to process during this iteration
wxList::compatibility_iterator lastPendingNode = m_pendingEvents->GetLast();
wxList::compatibility_iterator node = m_pendingEvents->GetFirst();
while ( node )
{
@@ -1127,6 +1130,13 @@ void wxEvtHandler::ProcessPendingEvents()
wxENTER_CRIT_SECT( *m_eventsLocker);
#endif
// leave the loop once we have processed all events that were present
// at the start of ProcessPendingEvents because otherwise we could get
// into infinite loop if the pending event handler execution resulted
// in another event being posted
if ( node == lastPendingNode )
break;
node = m_pendingEvents->GetFirst();
}