-#if wxUSE_THREADS
- if ( !wxHandlersWithPendingEventsLocker )
- return;
-#endif
-
- wxENTER_CRIT_SECT( *wxHandlersWithPendingEventsLocker );
-
- wxCHECK_RET( wxHandlersWithPendingDelayedEvents->IsEmpty(),
- "this helper list should be empty" );
-
- if (wxHandlersWithPendingEvents)
- {
- // 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 = wxHandlersWithPendingEvents->GetFirst();
- while (node)
- {
- // In ProcessPendingEvents(), new handlers might be added
- // and we can safely leave the critical section here.
- wxLEAVE_CRIT_SECT( *wxHandlersWithPendingEventsLocker );
-
- wxEvtHandler *handler = (wxEvtHandler *)node->GetData();
- handler->ProcessPendingEvents();
-
- wxENTER_CRIT_SECT( *wxHandlersWithPendingEventsLocker );
-
- // restart as the iterators could have been invalidated
- node = wxHandlersWithPendingEvents->GetFirst();
- }
- }