don't remove handlers from wxPendingEvents list, they now do it themselves when they don't have any more events or are destroyed (should have been part of r51021)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51022 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-01-05 17:37:17 +00:00
parent 19c4d91638
commit cd844951fa

View File

@@ -359,21 +359,21 @@ void wxAppConsoleBase::ProcessPendingEvents()
if (wxPendingEvents) if (wxPendingEvents)
{ {
// iterate until the list becomes empty // iterate until the list becomes empty: the handlers remove themselves
// from it when they don't have any more pending events
wxList::compatibility_iterator node = wxPendingEvents->GetFirst(); wxList::compatibility_iterator node = wxPendingEvents->GetFirst();
while (node) while (node)
{ {
wxEvtHandler *handler = (wxEvtHandler *)node->GetData();
wxPendingEvents->Erase(node);
// In ProcessPendingEvents(), new handlers might be add // In ProcessPendingEvents(), new handlers might be add
// and we can safely leave the critical section here. // and we can safely leave the critical section here.
wxLEAVE_CRIT_SECT( *wxPendingEventsLocker ); wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
wxEvtHandler *handler = (wxEvtHandler *)node->GetData();
handler->ProcessPendingEvents(); handler->ProcessPendingEvents();
wxENTER_CRIT_SECT( *wxPendingEventsLocker ); wxENTER_CRIT_SECT( *wxPendingEventsLocker );
// restart as the iterators could have been invalidated
node = wxPendingEvents->GetFirst(); node = wxPendingEvents->GetFirst();
} }
} }