]> git.saurik.com Git - wxWidgets.git/commitdiff
don't lock the gs_prevCS critical section recursively (replaces patch 1857581)
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 2 Jan 2008 21:18:15 +0000 (21:18 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 2 Jan 2008 21:18:15 +0000 (21:18 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50993 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/log.h
src/common/log.cpp
src/generic/logg.cpp

index 30e0edb2cae0016aa06d0f603dd43f5fae056d1c..a4d800e62342da52523abad8ac21f70f957d5cbb 100644 (file)
@@ -308,9 +308,13 @@ protected:
     // log a message indicating the number of times the previous message was
     // repeated if ms_prevCounter > 0, does nothing otherwise; return the old
     // value of ms_prevCounter
-    unsigned LogLastRepetitionCountIfNeeded();
+    unsigned LogLastRepeatIfNeeded();
 
 private:
+    // implement of LogLastRepeatIfNeeded(): it assumes that the
+    // caller had already locked ms_prevCS
+    unsigned LogLastRepeatIfNeededUnlocked();
+
     // static variables
     // ----------------
 
index 13c01367530592d59451333d68e48d6429412e53..250b7b3924495804bc89de222025249efa338ac3 100644 (file)
@@ -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,7 @@ unsigned wxLog::LogLastRepetitionCountIfNeeded()
 
 wxLog::~wxLog()
 {
-    LogLastRepetitionCountIfNeeded();
+    LogLastRepeatIfNeeded();
 }
 
 /* static */
@@ -509,7 +514,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;
index cba360cc862e54c0a9681abfae3cad9d4c283c78..ecac929db9e95567fcf88cc25c1249c1c0e743e1 100644 (file)
@@ -275,7 +275,7 @@ void wxLogGui::Flush()
     // do it right now to block any new calls to Flush() while we're here
     m_bHasMessages = false;
 
-    const unsigned repeatCount = LogLastRepetitionCountIfNeeded();
+    const unsigned repeatCount = LogLastRepeatIfNeeded();
 
     wxString appName = wxTheApp->GetAppDisplayName();