]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/log.cpp
set listview extended styles after switching to report view and not only when creatin...
[wxWidgets.git] / src / common / log.cpp
index 13c01367530592d59451333d68e48d6429412e53..262477de4003838aa9cd3995f574f28f6dd39816 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,17 @@ unsigned wxLog::LogLastRepetitionCountIfNeeded()
 
 wxLog::~wxLog()
 {
-    LogLastRepetitionCountIfNeeded();
+    // Flush() must be called before destroying the object as otherwise some
+    // messages could be lost
+    if ( ms_prevCounter )
+    {
+        wxMessageOutputDebug().Printf
+        (
+            wxS("Last repeated message (\"%s\", %lu times) wasn't output"),
+            ms_prevString,
+            ms_prevCounter
+        );
+    }
 }
 
 /* static */
@@ -509,7 +524,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;
@@ -700,7 +715,7 @@ void wxLog::DoLogString(const wxString& szString, time_t t)
 
 void wxLog::Flush()
 {
-    // nothing to do here
+    LogLastRepeatIfNeeded();
 }
 
 /*static*/ bool wxLog::IsAllowedTraceMask(const wxString& mask)