X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5875d39c9ba19f518e691792524f2fd03261c825..4bc6f7a06c494917409bbb673526f090bc51d2d2:/src/common/event.cpp diff --git a/src/common/event.cpp b/src/common/event.cpp index 8b74ef2a81..e0ea296ae2 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: event.cpp +// Name: src/common/event.cpp // Purpose: Event classes // Author: Julian Smart // Modified by: @@ -25,7 +25,6 @@ #endif #ifndef WX_PRECOMP - #include "wx/defs.h" #include "wx/app.h" #include "wx/list.h" @@ -1140,7 +1139,7 @@ void wxEvtHandler::ProcessPendingEvents() wxENTER_CRIT_SECT( Lock() ); - if ( !--n ) + if ( --n == 0 ) break; } @@ -1345,6 +1344,10 @@ bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event ) wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData(); #endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES + // get next node before (maybe) calling the event handler as it could + // call Disconnect() invalidating the current node + node = node->GetNext(); + if ((event.GetEventType() == entry->m_eventType) && (entry->m_fn != 0)) { wxEvtHandler *handler = @@ -1359,8 +1362,6 @@ bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event ) return true; } } - - node = node->GetNext(); } return false;