X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a05166568cecbcfa53a2874978422e8f229fbdb4..04d24675d3d26e9ae8af8b4bd390532d03adcbe1:/src/common/log.cpp diff --git a/src/common/log.cpp b/src/common/log.cpp index 13c0136753..262477de40 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -457,10 +457,15 @@ void WXDLLIMPEXP_BASE wxVLogSysError(unsigned long err, const wxString& format, // wxLog class implementation // ---------------------------------------------------------------------------- -unsigned wxLog::LogLastRepetitionCountIfNeeded() +unsigned wxLog::LogLastRepeatIfNeeded() { wxCRIT_SECT_LOCKER(lock, ms_prevCS); + return LogLastRepeatIfNeededUnlocked(); +} + +unsigned wxLog::LogLastRepeatIfNeededUnlocked() +{ const unsigned count = ms_prevCounter; if ( ms_prevCounter ) @@ -485,7 +490,17 @@ unsigned wxLog::LogLastRepetitionCountIfNeeded() wxLog::~wxLog() { - LogLastRepetitionCountIfNeeded(); + // Flush() must be called before destroying the object as otherwise some + // messages could be lost + if ( ms_prevCounter ) + { + wxMessageOutputDebug().Printf + ( + wxS("Last repeated message (\"%s\", %lu times) wasn't output"), + ms_prevString, + ms_prevCounter + ); + } } /* static */ @@ -509,7 +524,7 @@ void wxLog::OnLog(wxLogLevel level, const wxString& szString, time_t t) return; } - pLogger->LogLastRepetitionCountIfNeeded(); + pLogger->LogLastRepeatIfNeededUnlocked(); // reset repetition counter for a new message ms_prevString = szString; @@ -700,7 +715,7 @@ void wxLog::DoLogString(const wxString& szString, time_t t) void wxLog::Flush() { - // nothing to do here + LogLastRepeatIfNeeded(); } /*static*/ bool wxLog::IsAllowedTraceMask(const wxString& mask)