]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix wxLogChain (and wxLogWindow deriving from it) broken by wxLog changes.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 5 Dec 2009 01:32:45 +0000 (01:32 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 5 Dec 2009 01:32:45 +0000 (01:32 +0000)
wxLogChain::DoLogRecord() only called DoLogRecord() on the old logger but not
the new one when the new logger was the same object as wxLogChain itself as is
always the case for wxLogWindow. The result was that nothing was logged into
the window.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62777 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/log.cpp

index 98d73a6dde719983961b243bc0bdc9b41fefebf6..1e8d596b06f9a42f10fcba9c50a37e4682d0e0f2 100644 (file)
@@ -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__