From ccaf2891c9082773460c50c7eb7a910ea51e7003 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 6 Jul 2013 22:57:05 +0000 Subject: [PATCH] Reuse wxMessageOutputStderr for wxLogStderr implementation. In addition to avoiding (tiny) code duplication, this ensures that both places use the stream in the same orientation, i.e. either both use the narrow functions or the wide ones. Thus, it fixes a problem with output simply disappearing if wxLogStderr and wxMessageOutputStderr were both used: the one used first disabled any output by the other one. Closes #14782. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74427 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/log.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/log.cpp b/src/common/log.cpp index 53ce213b50..376a93365b 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -856,8 +856,10 @@ wxLogStderr::wxLogStderr(FILE *fp) void wxLogStderr::DoLogText(const wxString& msg) { - wxFputs(msg + '\n', m_fp); - fflush(m_fp); + // First send it to stderr, even if we don't have it (e.g. in a Windows GUI + // application under) it's not a problem to try to use it and it's easier + // than determining whether we do have it or not. + wxMessageOutputStderr(m_fp).Output(msg); // under GUI systems such as Windows or Mac, programs usually don't have // stderr at all, so show the messages also somewhere else, typically in -- 2.45.2