]> git.saurik.com Git - wxWidgets.git/commitdiff
don't remove handlers from wxPendingEvents list, they now do it themselves when they...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 5 Jan 2008 17:37:17 +0000 (17:37 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 5 Jan 2008 17:37:17 +0000 (17:37 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51022 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/appbase.cpp

index d2b8a4c3f309060d50a88baa6933249d392d14a0..209241a55b2a32d10922ebb23950decda3c5cca9 100644 (file)
@@ -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();
         }
     }