X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f13b39c0c3064fb073276370488161ca194839d4..1b6f93fcfe211e81c77d7485c4c3786a846c84df:/src/common/memory.cpp diff --git a/src/common/memory.cpp b/src/common/memory.cpp index 45d0b50816..a7439bacfd 100644 --- a/src/common/memory.cpp +++ b/src/common/memory.cpp @@ -44,15 +44,6 @@ #include "wx/ioswrap.h" -// Obsolete -#if 0 -#if wxUSE_IOSTREAMH - #include -#else - #include -#endif -#endif - #if !defined(__WATCOMC__) && !(defined(__VMS__) && ( __VMS_VER < 70000000 ) )\ && !defined( __MWERKS__ ) && !defined(__SALFORDC__) #include @@ -76,6 +67,13 @@ #include "wx/memory.h" +#if wxUSE_THREADS && defined(__WXDEBUG__) && !defined(__WXMAC__) +#define USE_THREADSAFE_MEMORY_ALLOCATION 1 +#else +#define USE_THREADSAFE_MEMORY_ALLOCATION 0 +#endif + + #ifdef new #undef new #endif @@ -859,7 +857,7 @@ int wxDebugContext::CountObjectsLeft(bool sinceCheckpoint) return n ; } -#if wxUSE_THREADS +#if USE_THREADSAFE_MEMORY_ALLOCATION static bool memSectionOk = FALSE; class MemoryCriticalSection : public wxCriticalSection @@ -892,7 +890,7 @@ static MemoryCriticalSection memLocker; // TODO: store whether this is a vector or not. void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, bool WXUNUSED(isVect) ) { -#if wxUSE_THREADS +#if USE_THREADSAFE_MEMORY_ALLOCATION MemoryCriticalSectionLocker lock(memLocker); #endif @@ -952,7 +950,7 @@ void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, // TODO: check whether was allocated as a vector void wxDebugFree(void * buf, bool WXUNUSED(isVect) ) { -#if wxUSE_THREADS +#if USE_THREADSAFE_MEMORY_ALLOCATION MemoryCriticalSectionLocker lock(memLocker); #endif