X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a2d382650097c5834093a8af0566e1c1ff683c8d..f0875501313903140a41dca0ba6ee2d85ed0536c:/src/common/log.cpp diff --git a/src/common/log.cpp b/src/common/log.cpp index 9ca1c34bd7..c2a69b6714 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -457,13 +457,13 @@ void WXDLLEXPORT wxVLogSysError(unsigned long err, const wxString& format, va_li // wxLog class implementation // ---------------------------------------------------------------------------- -/* static */ -void wxLog::LogLastRepetitionCountIfNeeded() +unsigned wxLog::LogLastRepetitionCountIfNeeded() { wxCRIT_SECT_LOCKER(lock, ms_prevCS); - wxLog *pLogger = GetActiveTarget(); - if ( pLogger && ms_prevCounter ) + const unsigned count = ms_prevCounter; + + if ( ms_prevCounter ) { wxString msg; #if wxUSE_INTL @@ -477,8 +477,10 @@ void wxLog::LogLastRepetitionCountIfNeeded() #endif ms_prevCounter = 0; ms_prevString.clear(); - pLogger->DoLog(ms_prevLevel, msg, ms_prevTimeStamp); + DoLog(ms_prevLevel, msg, ms_prevTimeStamp); } + + return count; } wxLog::~wxLog() @@ -507,7 +509,7 @@ void wxLog::OnLog(wxLogLevel level, const wxString& szString, time_t t) return; } - LogLastRepetitionCountIfNeeded(); + pLogger->LogLastRepetitionCountIfNeeded(); // reset repetition counter for a new message ms_prevString = szString; @@ -904,6 +906,9 @@ wxLogInterposerTemp::wxLogInterposerTemp() // static variables // ---------------------------------------------------------------------------- +#if wxUSE_THREADS +wxCriticalSection wxLog::ms_prevCS; +#endif // wxUSE_THREADS bool wxLog::ms_bRepetCounting = false; wxString wxLog::ms_prevString; unsigned int wxLog::ms_prevCounter = 0;