]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/app.cpp
Fixed wxPostScript printing problem (used wrong constructor, and the right
[wxWidgets.git] / src / gtk / app.cpp
index 5c08aad9d690859e9c8bf6a3146d8ecbc8b171da..e3bb20d00d55dc2ed4241f3bf1035b3f4c692e08 100644 (file)
@@ -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();