]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/appcmn.cpp
Added Set/GetThemeEnabled and used this for determining whether to paint a theme
[wxWidgets.git] / src / common / appcmn.cpp
index 357f388c085c0a65b1f7699982ae9625bb1d20e3..18d3dcafff3abb6e72ccf80e3e324fe2501aa150 100644 (file)
 
 #ifndef WX_PRECOMP
     #include "wx/app.h"
+    #include "wx/list.h"
 #endif
 
 #include "wx/thread.h"
+#include "wx/confbase.h"
 
 // ===========================================================================
 // implementation
 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()
+{
+#if wxUSE_CONFIG
+    // delete the config object if any (don't use Get() here, but Set()
+    // because Get() could create a new config object)
+    delete wxConfigBase::Set((wxConfigBase *) NULL);
+#endif // wxUSE_CONFIG
+
+    return 0;
+}