]> git.saurik.com Git - wxWidgets.git/commitdiff
delayed destruction of global memLocker object
authorDimitri Schoolwerth <dimitri.schoolwerth@gmail.com>
Tue, 4 May 2004 14:19:30 +0000 (14:19 +0000)
committerDimitri Schoolwerth <dimitri.schoolwerth@gmail.com>
Tue, 4 May 2004 14:19:30 +0000 (14:19 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27095 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/memory.cpp

index e32260e3aadeaa3b7c0af85ad1aaa050ff307dbb..ebb8d27a49408b044f4a99f611463db050fbed6a 100644 (file)
@@ -910,14 +910,19 @@ private:
        bool    m_locked;
 };
 
-static MemoryCriticalSection memLocker;
+MemoryCriticalSection &GetMemLocker()
+{
+    static MemoryCriticalSection memLocker;
+    return memLocker;
+}
+
 #endif
 
 // TODO: store whether this is a vector or not.
 void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, bool WXUNUSED(isVect) )
 {
 #if USE_THREADSAFE_MEMORY_ALLOCATION
-  MemoryCriticalSectionLocker lock(memLocker);
+  MemoryCriticalSectionLocker lock(GetMemLocker());
 #endif
 
   // If not in debugging allocation mode, do the normal thing
@@ -977,7 +982,7 @@ void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject,
 void wxDebugFree(void * buf, bool WXUNUSED(isVect) )
 {
 #if USE_THREADSAFE_MEMORY_ALLOCATION
-  MemoryCriticalSectionLocker lock(memLocker);
+  MemoryCriticalSectionLocker lock(GetMemLocker());
 #endif
 
   if (!buf)