From 6900a89752a9da56f653e388f2248e9e204a9f85 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 26 Jan 2010 12:33:34 +0000 Subject: [PATCH] Don't pass logs at unknown levels to wxLog::DoLogRecord() from wxLogGui. This results in an assert in DoLogText() which is not implemented in the base class but ends up being called as DoLogTextAtLevel() doesn't know how to handle non-standard log levels otherwise. This assert happened if you simply called wxLogMessage(wxLOG_User, ...) in the program. Just ignore messages at unknown log levels instead in wxLogGui, by definition it can't handle them anyhow. See also r63167. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63275 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/logg.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/generic/logg.cpp b/src/generic/logg.cpp index be7d63af69..e769bfb2bd 100644 --- a/src/generic/logg.cpp +++ b/src/generic/logg.cpp @@ -417,10 +417,25 @@ void wxLogGui::DoLogRecord(wxLogLevel level, m_bHasMessages = true; break; - default: - // let the base class deal with debug/trace messages as well as any - // custom levels + case wxLOG_Debug: + case wxLOG_Trace: + // let the base class deal with debug/trace messages wxLog::DoLogRecord(level, msg, info); + break; + + case wxLOG_FatalError: + case wxLOG_Max: + // fatal errors are shown immediately and terminate the program so + // we should never see them here + wxFAIL_MSG("unexpected log level"); + break; + + case wxLOG_Progress: + case wxLOG_User: + // just ignore those: passing them to the base class would result + // in asserts from DoLogText() because DoLogTextAtLevel() would + // call it as it doesn't know how to handle these levels otherwise + break; } }