]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/init.cpp
find available samples, demos and contribs at runtime
[wxWidgets.git] / src / common / init.cpp
index 244490529f04fa88efe5271aef7f2501d1d1ebf5..b3cd9aa66df9f2d0b3c8a681d90d283a394457d3 100644 (file)
 
 #include "wx/module.h"
 
-// ----------------------------------------------------------------------------
-// global vars
-// ----------------------------------------------------------------------------
-
-WXDLLEXPORT wxApp *wxTheApp = NULL;
-
-wxAppInitializerFunction
-    wxAppBase::m_appInitFn = (wxAppInitializerFunction)NULL;
-
 // ----------------------------------------------------------------------------
 // private classes
 // ----------------------------------------------------------------------------
 
-class /* no WXDLLEXPORT */ wxConsoleApp : public wxApp
+// we need a dummy app object if the user doesn't want to create a real one
+class wxDummyConsoleApp : public wxApp
 {
 public:
-    virtual int OnRun() { wxFAIL_MSG(wxT("unreachable")); return 0; }
+    virtual int OnRun() { wxFAIL_MSG( _T("unreachable code") ); return 0; }
 };
 
 // ----------------------------------------------------------------------------
@@ -68,21 +60,6 @@ static size_t gs_nInitCount = 0;
 // implementation
 // ============================================================================
 
-// ----------------------------------------------------------------------------
-// stubs for some GUI functions
-// ----------------------------------------------------------------------------
-
-void WXDLLEXPORT wxExit()
-{
-    abort();
-}
-
-// Yield to other apps/messages
-void WXDLLEXPORT wxWakeUpIdle()
-{
-    // do nothing
-}
-
 // ----------------------------------------------------------------------------
 // wxBase-specific functions
 // ----------------------------------------------------------------------------
@@ -103,7 +80,7 @@ bool WXDLLEXPORT wxInitialize()
         return FALSE;
     }
 
-    wxTheApp = new wxConsoleApp;
+    wxTheApp = new wxDummyConsoleApp;
 
     if ( !wxTheApp )
     {
@@ -219,6 +196,14 @@ static void DoCleanUp()
 
     wxClassInfo::CleanUpClasses();
 
+    // TODO: this should really be done in ~wxApp
+#if wxUSE_UNICODE
+    for ( int mb_argc = 0; mb_argc < wxTheApp->argc; mb_argc++ )
+    {
+        free(wxTheApp->argv[mb_argc]);
+    }
+#endif // wxUSE_UNICODE
+
     // delete the application object
     delete wxTheApp;
     wxTheApp = (wxApp *)NULL;