made LogLastRepetitionCountIfNeeded() non static to avoid recreating the log target from ~wxLog

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49587 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-11-01 20:22:06 +00:00
parent 36427ad571
commit c1f80bc0a6
3 changed files with 5 additions and 7 deletions

View File

@@ -306,7 +306,7 @@ protected:
// log a message indicating the number of times the previous message was // log a message indicating the number of times the previous message was
// repeated if ms_prevCounter > 0, does nothing otherwise; return the old // repeated if ms_prevCounter > 0, does nothing otherwise; return the old
// value of ms_prevCounter // value of ms_prevCounter
static unsigned LogLastRepetitionCountIfNeeded(); unsigned LogLastRepetitionCountIfNeeded();
private: private:
// static variables // static variables

View File

@@ -457,15 +457,13 @@ void WXDLLEXPORT wxVLogSysError(unsigned long err, const wxString& format, va_li
// wxLog class implementation // wxLog class implementation
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/* static */
unsigned wxLog::LogLastRepetitionCountIfNeeded() unsigned wxLog::LogLastRepetitionCountIfNeeded()
{ {
wxCRIT_SECT_LOCKER(lock, ms_prevCS); wxCRIT_SECT_LOCKER(lock, ms_prevCS);
const unsigned count = ms_prevCounter; const unsigned count = ms_prevCounter;
wxLog *pLogger = GetActiveTarget(); if ( ms_prevCounter )
if ( pLogger && ms_prevCounter )
{ {
wxString msg; wxString msg;
#if wxUSE_INTL #if wxUSE_INTL
@@ -479,7 +477,7 @@ unsigned wxLog::LogLastRepetitionCountIfNeeded()
#endif #endif
ms_prevCounter = 0; ms_prevCounter = 0;
ms_prevString.clear(); ms_prevString.clear();
pLogger->DoLog(ms_prevLevel, msg, ms_prevTimeStamp); DoLog(ms_prevLevel, msg, ms_prevTimeStamp);
} }
return count; return count;
@@ -511,7 +509,7 @@ void wxLog::OnLog(wxLogLevel level, const wxString& szString, time_t t)
return; return;
} }
LogLastRepetitionCountIfNeeded(); pLogger->LogLastRepetitionCountIfNeeded();
// reset repetition counter for a new message // reset repetition counter for a new message
ms_prevString = szString; ms_prevString = szString;

View File

@@ -275,7 +275,7 @@ void wxLogGui::Flush()
// do it right now to block any new calls to Flush() while we're here // do it right now to block any new calls to Flush() while we're here
m_bHasMessages = false; m_bHasMessages = false;
const unsigned repeatCount = wxLog::LogLastRepetitionCountIfNeeded(); const unsigned repeatCount = LogLastRepetitionCountIfNeeded();
wxString appName = wxTheApp->GetAppDisplayName(); wxString appName = wxTheApp->GetAppDisplayName();