From 645bd39e5dc095e0a64c76629625f8ee4afd5a7a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 1 Nov 2007 20:35:45 +0000 Subject: [PATCH] don't recreate wxLog target from ~wxLog (adaptation of changes in trunk r49587) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@49589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/log.h | 8 ++++++-- src/common/log.cpp | 15 ++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/include/wx/log.h b/include/wx/log.h index 223a6f1498..65638fc166 100644 --- a/include/wx/log.h +++ b/include/wx/log.h @@ -263,8 +263,7 @@ protected: virtual void DoLogString(const wxChar *szString, time_t t); // log a line containing the number of times the previous message was - // repeated - // returns: the number + // repeated and returns this number (which can be 0) static unsigned DoLogNumberOfRepeats(); private: @@ -294,6 +293,11 @@ private: static wxTraceMask ms_ulTraceMask; // controls wxLogTrace behaviour static wxArrayString ms_aTraceMasks; // more powerful filter for wxLogTrace + + + // this is the replacement of DoLogNumberOfRepeats() (which has to be kept + // to avoid breaking ABI in this version) + unsigned LogLastRepetitionCountIfNeeded(); }; // ---------------------------------------------------------------------------- diff --git a/src/common/log.cpp b/src/common/log.cpp index de1740f468..d10e642da7 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -285,12 +285,17 @@ wxCRIT_SECT_DECLARE(gs_prevCS); /* static */ unsigned wxLog::DoLogNumberOfRepeats() +{ + wxLog * const pLogger = GetActiveTarget(); + return pLogger ? pLogger->LogLastRepetitionCountIfNeeded() : 0u; +} + +unsigned wxLog::LogLastRepetitionCountIfNeeded() { wxCRIT_SECT_LOCKER(lock, gs_prevCS); long retval = ms_prevCounter; - wxLog *pLogger = GetActiveTarget(); - if ( pLogger && ms_prevCounter > 0 ) + if ( ms_prevCounter > 0 ) { wxString msg; #if wxUSE_INTL @@ -303,14 +308,14 @@ unsigned wxLog::DoLogNumberOfRepeats() #endif ms_prevCounter = 0; ms_prevString.clear(); - pLogger->DoLog(ms_prevLevel, msg.c_str(), ms_prevTimeStamp); + DoLog(ms_prevLevel, msg.c_str(), ms_prevTimeStamp); } return retval; } wxLog::~wxLog() { - wxLog::DoLogNumberOfRepeats(); + LogLastRepetitionCountIfNeeded(); } /* static */ @@ -334,7 +339,7 @@ void wxLog::OnLog(wxLogLevel level, const wxChar *szString, time_t t) return; } - DoLogNumberOfRepeats(); + pLogger->LogLastRepetitionCountIfNeeded(); // reset repetition counter for a new message ms_prevString = szString;