]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/log.cpp
remove default wxDC ctor to make it impossible to construct DCs without the associate...
[wxWidgets.git] / src / common / log.cpp
index 9ca1c34bd7332d777acaef2053d46f5a2f9908ff..c2a69b67142604a141ed6fd285c880bfade31390 100644 (file)
@@ -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;