]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/log.h
fixed memory leak in wxXmlResource introduced when fixing wxVector<> usage (patch...
[wxWidgets.git] / include / wx / log.h
index adab3ceb5baa5169a231eaa8b3af890b107faa0a..a4d800e62342da52523abad8ac21f70f957d5cbb 100644 (file)
 
 #include "wx/defs.h"
 
 
 #include "wx/defs.h"
 
+#if wxUSE_THREADS
+    class WXDLLIMPEXP_FWD_BASE wxCriticalSection;
+#endif
+
 // ----------------------------------------------------------------------------
 // common constants for use in wxUSE_LOG/!wxUSE_LOG
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // common constants for use in wxUSE_LOG/!wxUSE_LOG
 // ----------------------------------------------------------------------------
@@ -302,10 +306,15 @@ protected:
 #endif
 
     // log a message indicating the number of times the previous message was
 #endif
 
     // log a message indicating the number of times the previous message was
-    // repeated; only does something if ms_prevCounter > 0
-    static void LogLastRepetitionCountIfNeeded();
+    // repeated if ms_prevCounter > 0, does nothing otherwise; return the old
+    // value of ms_prevCounter
+    unsigned LogLastRepeatIfNeeded();
 
 private:
 
 private:
+    // implement of LogLastRepeatIfNeeded(): it assumes that the
+    // caller had already locked ms_prevCS
+    unsigned LogLastRepeatIfNeededUnlocked();
+
     // static variables
     // ----------------
 
     // static variables
     // ----------------
 
@@ -313,6 +322,9 @@ private:
     // with the number of times it was repeated
     static bool        ms_bRepetCounting;
 
     // with the number of times it was repeated
     static bool        ms_bRepetCounting;
 
+#if wxUSE_THREADS
+    static wxCriticalSection ms_prevCS; // protects the ms_prev values below
+#endif
     static wxString    ms_prevString;   // previous message that was logged
     static unsigned    ms_prevCounter;  // how many times it was repeated
     static time_t      ms_prevTimeStamp;// timestamp of the previous message
     static wxString    ms_prevString;   // previous message that was logged
     static unsigned    ms_prevCounter;  // how many times it was repeated
     static time_t      ms_prevTimeStamp;// timestamp of the previous message