From 3d2eaa5d5917bedbf5b5a54a24d7559fd1e5df67 Mon Sep 17 00:00:00 2001 From: Dimitri Schoolwerth Date: Tue, 4 May 2004 14:19:30 +0000 Subject: [PATCH] delayed destruction of global memLocker object git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27095 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/memory.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/common/memory.cpp b/src/common/memory.cpp index e32260e3aa..ebb8d27a49 100644 --- a/src/common/memory.cpp +++ b/src/common/memory.cpp @@ -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) -- 2.47.2