]> git.saurik.com Git - wxWidgets.git/commitdiff
fixes necessary for the default GUI log target to be used in Debug mode
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 13 Apr 2003 02:22:00 +0000 (02:22 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 13 Apr 2003 02:22:00 +0000 (02:22 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20180 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/app.cpp
src/mac/carbon/app.cpp

index 0e4ce104f2799e6b90d71f48facb49f8ba04a5a7..71ea9d67d1786234d6a3b2e287a41b5f879bd14c 100644 (file)
@@ -553,37 +553,24 @@ bool wxApp::Initialize()
     wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
     wxTheColourDatabase->Initialize();
 
-#ifdef __WXDEBUG__
-#if wxUSE_LOG
-    // flush the logged messages if any and install a 'safer' log target: the
-    // default one (wxLogGui) can't be used after the resources are freed just
-    // below and the user suppliedo ne might be even more unsafe (using any
-    // wxWindows GUI function is unsafe starting from now)
-    wxLog::DontCreateOnDemand();
-
-    // this will flush the old messages if any
-    delete wxLog::SetActiveTarget(new wxLogStderr);
-#endif // wxUSE_LOG
-#endif
+    wxWinMacWindowList = new wxList(wxKEY_INTEGER);
+    wxWinMacControlList = new wxList(wxKEY_INTEGER);
 
-  wxWinMacWindowList = new wxList(wxKEY_INTEGER);
-  wxWinMacControlList = new wxList(wxKEY_INTEGER);
+    wxInitializeStockLists();
+    wxInitializeStockObjects();
 
-  wxInitializeStockLists();
-  wxInitializeStockObjects();
+    wxBitmap::InitStandardHandlers();
 
-  wxBitmap::InitStandardHandlers();
-
-  wxModule::RegisterModules();
-  if (!wxModule::InitializeModules()) {
-     return FALSE;
-  }
+    wxModule::RegisterModules();
+    if (!wxModule::InitializeModules()) {
+        return FALSE;
+    }
 
-  wxMacCreateNotifierTable() ;
+    wxMacCreateNotifierTable() ;
 
-  UMAShowArrowCursor() ;
+    UMAShowArrowCursor() ;
 
-  return TRUE;
+    return TRUE;
 }
 
 bool wxApp::OnInitGui()
@@ -801,8 +788,15 @@ void wxStAppResource::OpenSharedLibraryResource(const void *initBlock)
             theModule = NSModuleForSymbol(theSymbol);
             theLibPath = NSLibraryNameForModule(theModule);
 
+            // if we call wxLogDebug from here then, as wxTheApp hasn't been
+            // created yet when we're called from wxApp::Initialize(), wxLog
+            // is going to create a default stderr-based log target instead of
+            // the expected normal GUI one -- don't do it, if we really want
+            // to see this message just use fprintf() here
+#if 0
             wxLogDebug( wxT("wxMac library installation name is '%s'"),
                         theLibPath );
+#endif
 
             // allocate copy to replace .dylib.* extension with .rsrc
             theResPath = strdup(theLibPath);
@@ -817,8 +811,10 @@ void wxStAppResource::OpenSharedLibraryResource(const void *initBlock)
                 // overwrite extension with ".rsrc"
                 strcpy(theExt, ".rsrc");
 
+#if 0
                 wxLogDebug( wxT("wxMac resources file name is '%s'"),
                             theResPath );
+#endif
 
                 theErr = FSPathMakeRef((UInt8 *) theResPath, &theResRef, false);
                 if (theErr != noErr) {
@@ -832,8 +828,11 @@ void wxStAppResource::OpenSharedLibraryResource(const void *initBlock)
                                                  &gSharedLibraryResource);
                 }
                 if (theErr != noErr) {
-                    wxLogDebug( wxT("unable to open wxMac resource file '%s'"),
-                                theResPath );
+#ifdef __WXDEBUG__
+                    fprintf(stderr,
+                            wxT("unable to open wxMac resource file '%s'\n"),
+                            theResPath );
+#endif // __WXDEBUG__
                 }
 
                 // free duplicated resource file path
index 0e4ce104f2799e6b90d71f48facb49f8ba04a5a7..71ea9d67d1786234d6a3b2e287a41b5f879bd14c 100644 (file)
@@ -553,37 +553,24 @@ bool wxApp::Initialize()
     wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
     wxTheColourDatabase->Initialize();
 
-#ifdef __WXDEBUG__
-#if wxUSE_LOG
-    // flush the logged messages if any and install a 'safer' log target: the
-    // default one (wxLogGui) can't be used after the resources are freed just
-    // below and the user suppliedo ne might be even more unsafe (using any
-    // wxWindows GUI function is unsafe starting from now)
-    wxLog::DontCreateOnDemand();
-
-    // this will flush the old messages if any
-    delete wxLog::SetActiveTarget(new wxLogStderr);
-#endif // wxUSE_LOG
-#endif
+    wxWinMacWindowList = new wxList(wxKEY_INTEGER);
+    wxWinMacControlList = new wxList(wxKEY_INTEGER);
 
-  wxWinMacWindowList = new wxList(wxKEY_INTEGER);
-  wxWinMacControlList = new wxList(wxKEY_INTEGER);
+    wxInitializeStockLists();
+    wxInitializeStockObjects();
 
-  wxInitializeStockLists();
-  wxInitializeStockObjects();
+    wxBitmap::InitStandardHandlers();
 
-  wxBitmap::InitStandardHandlers();
-
-  wxModule::RegisterModules();
-  if (!wxModule::InitializeModules()) {
-     return FALSE;
-  }
+    wxModule::RegisterModules();
+    if (!wxModule::InitializeModules()) {
+        return FALSE;
+    }
 
-  wxMacCreateNotifierTable() ;
+    wxMacCreateNotifierTable() ;
 
-  UMAShowArrowCursor() ;
+    UMAShowArrowCursor() ;
 
-  return TRUE;
+    return TRUE;
 }
 
 bool wxApp::OnInitGui()
@@ -801,8 +788,15 @@ void wxStAppResource::OpenSharedLibraryResource(const void *initBlock)
             theModule = NSModuleForSymbol(theSymbol);
             theLibPath = NSLibraryNameForModule(theModule);
 
+            // if we call wxLogDebug from here then, as wxTheApp hasn't been
+            // created yet when we're called from wxApp::Initialize(), wxLog
+            // is going to create a default stderr-based log target instead of
+            // the expected normal GUI one -- don't do it, if we really want
+            // to see this message just use fprintf() here
+#if 0
             wxLogDebug( wxT("wxMac library installation name is '%s'"),
                         theLibPath );
+#endif
 
             // allocate copy to replace .dylib.* extension with .rsrc
             theResPath = strdup(theLibPath);
@@ -817,8 +811,10 @@ void wxStAppResource::OpenSharedLibraryResource(const void *initBlock)
                 // overwrite extension with ".rsrc"
                 strcpy(theExt, ".rsrc");
 
+#if 0
                 wxLogDebug( wxT("wxMac resources file name is '%s'"),
                             theResPath );
+#endif
 
                 theErr = FSPathMakeRef((UInt8 *) theResPath, &theResRef, false);
                 if (theErr != noErr) {
@@ -832,8 +828,11 @@ void wxStAppResource::OpenSharedLibraryResource(const void *initBlock)
                                                  &gSharedLibraryResource);
                 }
                 if (theErr != noErr) {
-                    wxLogDebug( wxT("unable to open wxMac resource file '%s'"),
-                                theResPath );
+#ifdef __WXDEBUG__
+                    fprintf(stderr,
+                            wxT("unable to open wxMac resource file '%s'\n"),
+                            theResPath );
+#endif // __WXDEBUG__
                 }
 
                 // free duplicated resource file path