From cd844951fa86d2aa9a02b01cc8c9f0dc209f28a0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 5 Jan 2008 17:37:17 +0000 Subject: [PATCH] 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 --- src/common/appbase.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index d2b8a4c3f3..209241a55b 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -359,21 +359,21 @@ void wxAppConsoleBase::ProcessPendingEvents() 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(); while (node) { - wxEvtHandler *handler = (wxEvtHandler *)node->GetData(); - wxPendingEvents->Erase(node); - // In ProcessPendingEvents(), new handlers might be add // and we can safely leave the critical section here. wxLEAVE_CRIT_SECT( *wxPendingEventsLocker ); + wxEvtHandler *handler = (wxEvtHandler *)node->GetData(); handler->ProcessPendingEvents(); wxENTER_CRIT_SECT( *wxPendingEventsLocker ); + // restart as the iterators could have been invalidated node = wxPendingEvents->GetFirst(); } } -- 2.45.2