-#if wxUSE_THREADS
- if ( !wxPendingEventsLocker )
- return;
-#endif
-
- wxENTER_CRIT_SECT( *wxPendingEventsLocker );
-
- if (wxPendingEvents)
- {
- // iterate until the list becomes empty
- 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 );
-
- handler->ProcessPendingEvents();