]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/log.cpp
remove workaround
[wxWidgets.git] / src / common / log.cpp
index 6731ccb9d23757a546e95e2af28a5cbfbe621ce7..1e8d596b06f9a42f10fcba9c50a37e4682d0e0f2 100644 (file)
 #undef wxLOG_COMPONENT
 const char *wxLOG_COMPONENT = "";
 
-#if wxUSE_THREADS
-
-wxTLS_TYPE(wxThreadSpecificInfo) wxThreadInfoVar;
-
 // this macro allows to define an object which will be initialized before any
 // other function in this file is called: this is necessary to allow log
 // functions to be used during static initialization (this is not advisable
@@ -92,6 +88,10 @@ wxTLS_TYPE(wxThreadSpecificInfo) wxThreadInfoVar;
                                                                               \
     type *gs_##name##Ptr = &Get##name()
 
+#if wxUSE_THREADS
+
+wxTLS_TYPE(wxThreadSpecificInfo) wxThreadInfoVar;
+
 namespace
 {
 
@@ -854,8 +854,15 @@ void wxLogChain::DoLogRecord(wxLogLevel level,
         m_logOld->LogRecord(level, msg, info);
 
     // and also send it to the new one
-    if ( m_logNew && m_logNew != this )
-        m_logNew->LogRecord(level, msg, info);
+    if ( m_logNew )
+    {
+        // don't call m_logNew->LogRecord() to avoid infinite recursion when
+        // m_logNew is this object itself
+        if ( m_logNew != this )
+            m_logNew->LogRecord(level, msg, info);
+        else
+            wxLog::DoLogRecord(level, msg, info);
+    }
 }
 
 #ifdef __VISUALC__