]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/app.cpp
Another Unicode fix.
[wxWidgets.git] / src / gtk / app.cpp
index 0bb4f7afed2c4513bfc5e69f54a3b8093f0f029a..e3bb20d00d55dc2ed4241f3bf1035b3f4c692e08 100644 (file)
@@ -438,7 +438,7 @@ void wxApp::SetTopWindow( wxWindow *win )
 
 bool wxApp::Initialize()
 {
-    wxBuffer = new char[BUFSIZ + 512];
+    wxBuffer = new wxChar[BUFSIZ + 512];
 
     wxClassInfo::InitializeClasses();
 
@@ -528,7 +528,7 @@ void wxApp::CleanUp()
 #if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
     if (wxDebugContext::CountObjectsLeft() > 0)
     {
-        wxLogDebug("There were memory leaks.\n");
+        wxLogDebug(_T("There were memory leaks.\n"));
         wxDebugContext::Dump();
         wxDebugContext::PrintStatistics();
     }
@@ -563,7 +563,7 @@ int wxEntry( int argc, char *argv[] )
     if (!wxTheApp)
     {
         wxCHECK_MSG( wxApp::GetInitializerFunction(), -1,
-                     "wxWindows error: No initializer - use IMPLEMENT_APP macro.\n" );
+                     _T("wxWindows error: No initializer - use IMPLEMENT_APP macro.\n") );
 
         wxAppInitializerFunction app_ini = wxApp::GetInitializerFunction();
 
@@ -572,7 +572,7 @@ int wxEntry( int argc, char *argv[] )
         wxTheApp = (wxApp*) test_app;
     }
 
-    wxCHECK_MSG( wxTheApp, -1, "wxWindows error: no application object" );
+    wxCHECK_MSG( wxTheApp, -1, _T("wxWindows error: no application object") );
 
     wxTheApp->argc = argc;
     wxTheApp->argv = argv;
@@ -581,39 +581,45 @@ int wxEntry( int argc, char *argv[] )
     wxStripExtension( name );
     wxTheApp->SetAppName( name );
 
-    if (!wxTheApp->OnInitGui())
-        return 0;
+    int retValue = 0;
+
+    if ( !wxTheApp->OnInitGui() )
+        retValue = -1;
 
     // Here frames insert themselves automatically into wxTopLevelWindows by
     // getting created in OnInit().
-    if (!wxTheApp->OnInit())
-        return 0;
-
-    wxTheApp->m_initialized = wxTopLevelWindows.GetCount() != 0;
+    if ( retValue == 0 )
+    {
+        if ( !wxTheApp->OnInit() )
+            retValue = -1;
+    }
 
-    int retValue = 0;
+    if ( retValue == 0 )
+    {
+        wxTheApp->m_initialized = wxTopLevelWindows.GetCount() != 0;
 
-    if (wxTheApp->Initialized())
-        retValue = wxTheApp->OnRun();
+        if (wxTheApp->Initialized())
+            retValue = wxTheApp->OnRun();
 
-    wxWindow *topWindow = wxTheApp->GetTopWindow();
-    if (topWindow)
-    {
-        // Forcibly delete the window.
-        if (topWindow->IsKindOf(CLASSINFO(wxFrame)) ||
-            topWindow->IsKindOf(CLASSINFO(wxDialog)) )
+        wxWindow *topWindow = wxTheApp->GetTopWindow();
+        if (topWindow)
         {
-            topWindow->Close( TRUE );
-            wxTheApp->DeletePendingObjects();
-        }
-        else
-        {
-            delete topWindow;
-            wxTheApp->SetTopWindow( (wxWindow*) NULL );
+            // Forcibly delete the window.
+            if (topWindow->IsKindOf(CLASSINFO(wxFrame)) ||
+                topWindow->IsKindOf(CLASSINFO(wxDialog)) )
+            {
+                topWindow->Close( TRUE );
+                wxTheApp->DeletePendingObjects();
+            }
+            else
+            {
+                delete topWindow;
+                wxTheApp->SetTopWindow( (wxWindow*) NULL );
+            }
         }
-    }
 
-    wxTheApp->OnExit();
+        wxTheApp->OnExit();
+    }
 
     // flush the logged messages if any
     wxLog *log = wxLog::GetActiveTarget();