]> git.saurik.com Git - wxWidgets.git/commitdiff
fix log target auto creation broken by recent changes
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 15 Jul 2009 12:36:09 +0000 (12:36 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 15 Jul 2009 12:36:09 +0000 (12:36 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61432 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/log.h
src/common/log.cpp

index 775fac228f791436a2da130fc6acf112a1f3c08d..c7bbf0b2dbf9c8def130a45e217ae2799c7f8e62 100644 (file)
@@ -606,6 +606,13 @@ private:
     static bool EnableThreadLogging(bool enable = true);
 #endif // wxUSE_THREADS
 
+    // get the active log target for the main thread, auto-creating it if
+    // necessary
+    //
+    // this is called from GetActiveTarget() and OnLog() when they're called
+    // from the main thread
+    static wxLog *GetMainThreadActiveTarget();
+
     // called from OnLog() if it's called from the main thread or if we have a
     // (presumably MT-safe) thread-specific logger and by FlushThreadMessages()
     // when it plays back the buffered messages logged from the other threads
index d3595d123495f3deea60905c620174c8809424a7..e0e0c03eea68b5e2304af01349333315810f9d0f 100644 (file)
@@ -294,7 +294,7 @@ wxLog::OnLog(wxLogLevel level,
     else
 #endif // wxUSE_THREADS
     {
-        logger = ms_pLogger;
+        logger = GetMainThreadActiveTarget();
         if ( !logger )
             return;
     }
@@ -464,6 +464,12 @@ wxLog *wxLog::GetActiveTarget()
     }
 #endif // wxUSE_THREADS
 
+    return GetMainThreadActiveTarget();
+}
+
+/* static */
+wxLog *wxLog::GetMainThreadActiveTarget()
+{
     if ( ms_bAutoCreate && ms_pLogger == NULL ) {
         // prevent infinite recursion if someone calls wxLogXXX() from
         // wxApp::CreateLogTarget()