X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e87271f35887a50e011c7c97fc63c35f5d623e50..afc94fa6b43722d604017798a767fa84ef883b47:/src/common/appcmn.cpp diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index d72316a6dd..d185f5bff0 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -34,6 +34,7 @@ #endif #include "wx/thread.h" +#include "wx/confbase.h" // =========================================================================== // implementation @@ -46,21 +47,40 @@ 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; +}