]> git.saurik.com Git - wxWidgets.git/commitdiff
Call MGL_init earlier in wxApp::Initialize to avoid crash
authorMichael Wetherell <mike.wetherell@ntlworld.com>
Sat, 30 Apr 2005 02:09:21 +0000 (02:09 +0000)
committerMichael Wetherell <mike.wetherell@ntlworld.com>
Sat, 30 Apr 2005 02:09:21 +0000 (02:09 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33921 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mgl/app.cpp

index b76b94ddd5b61373222b5228421aad88403e1984..62207edf46273a7a97e69bd54cc80d358fed13d3 100644 (file)
@@ -280,19 +280,22 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
     wxSetEnv(wxT("LFN"), wxT("N"));
 #endif
 
+    // intialize MGL before creating wxFontsManager since it uses MGL funcs
+    if ( MGL_init(".", NULL) == 0 )
+    {
+        wxLogError(_("Cannot initialize SciTech MGL!"));
+        return false;
+    }
+
     // must do it before calling wxAppBase::Initialize(), because fonts are
     // needed by stock lists which are created there
     wxTheFontsManager = new wxFontsManager;
 
     if ( !wxAppBase::Initialize(argc, argv) )
-        return false;
-
-    if ( MGL_init(".", NULL) == 0 )
     {
-        wxLogError(_("Cannot initialize SciTech MGL!"));
-
-        wxAppBase::CleanUp();
-
+        delete wxTheFontsManager;
+        wxTheFontsManager = NULL;
+        MGL_exit();
         return false;
     }