]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/appcmn.cpp
wxLocale now uses wxEncodingConverter (must be explicitly enabled)
[wxWidgets.git] / src / common / appcmn.cpp
index 3276436a6eec6f578fe393e434c2225ae3a402ca..d185f5bff00e9efc6876069792f58ffbb871269b 100644 (file)
 void wxAppBase::ProcessPendingEvents()
 {
     // ensure that we're the only thread to modify the pending events list
-    wxCRIT_SECT_LOCKER(locker, *wxPendingEventsLocker);
+    wxENTER_CRIT_SECT( *wxPendingEventsLocker );
 
     if ( !wxPendingEvents )
+    {
+        wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
         return;
+    }
 
     // iterate until the list becomes empty
     wxNode *node = wxPendingEvents->First();
     while (node)
     {
         wxEvtHandler *handler = (wxEvtHandler *)node->Data();
+        delete node;
 
+        // In ProcessPendingEvents(), new handlers might be add
+           // and we can safely leave the critical section here.
+        wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
         handler->ProcessPendingEvents();
+        wxENTER_CRIT_SECT( *wxPendingEventsLocker );
 
-        delete node;
         node = wxPendingEvents->First();
     }
+    
+    wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
 }
 
 int wxAppBase::OnExit()