-void wxApp::DeletePendingObjects()
-{
- wxNode *node = wxPendingDelete.First();
- while (node)
- {
- wxObject *obj = (wxObject *)node->Data();
-
- delete obj;
-
- if (wxPendingDelete.Find(obj))
- delete node;
-
- node = wxPendingDelete.First();
- }
-}
-
-bool wxApp::Initialize()
-{
- wxBuffer = new wxChar[BUFSIZ + 512];
-
- wxClassInfo::InitializeClasses();
-
-#if wxUSE_INTL
- wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());
-#endif
-
- // GL: I'm annoyed ... I don't know where to put this and I don't want to
- // create a module for that as it's part of the core.
-#if wxUSE_THREADS
- wxPendingEvents = new wxList();
- wxPendingEventsLocker = new wxCriticalSection();
-#endif
-
- wxTheColourDatabase = new wxColourDatabase( wxKEY_STRING );
- wxTheColourDatabase->Initialize();
-
- wxInitializeStockLists();
- wxInitializeStockObjects();
-
-#if wxUSE_WX_RESOURCES
- wxInitializeResourceSystem();
-#endif
-
- wxModule::RegisterModules();
- if (!wxModule::InitializeModules()) return FALSE;
-
- return TRUE;
-}
-
-void wxApp::CleanUp()
-{
- wxModule::CleanUpModules();
-
-#if wxUSE_WX_RESOURCES
- wxCleanUpResourceSystem();
-#endif
-
- if (wxTheColourDatabase)
- delete wxTheColourDatabase;
-
- wxTheColourDatabase = (wxColourDatabase*) NULL;
-
- wxDeleteStockObjects();
-
- wxDeleteStockLists();
-
- delete wxTheApp;
- wxTheApp = (wxApp*) NULL;
-
- // GL: I'm annoyed ... I don't know where to put this and I don't want to
- // create a module for that as it's part of the core.
-#if wxUSE_THREADS
- delete wxPendingEvents;
- delete wxPendingEventsLocker;
-#endif
-
- delete[] wxBuffer;
-
- wxClassInfo::CleanUpClasses();
-
- // check for memory leaks
-#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
- if (wxDebugContext::CountObjectsLeft(TRUE) > 0)
- {
- wxLogDebug(wxT("There were memory leaks.\n"));
- wxDebugContext::Dump();
- wxDebugContext::PrintStatistics();
- }
-#endif // Debug
-
-#if wxUSE_LOG
- // do this as the very last thing because everything else can log messages
- wxLog::DontCreateOnDemand();
-
- wxLog *oldLog = wxLog::SetActiveTarget( (wxLog*) NULL );
- if (oldLog)
- delete oldLog;
-#endif // wxUSE_LOG
-}
-
-//-----------------------------------------------------------------------------
-// wxEntry
-//-----------------------------------------------------------------------------
-
-// NB: argc and argv may be changed here, pass by reference!
-int wxEntryStart( int& argc, char *argv[] )