-#ifdef NO_DEBUG_ALLOCATION
- return malloc(size);
-#else
- return wxDebugAlloc(size, fileName, lineNum, FALSE, FALSE);
-#endif
+public:
+ inline MemoryCriticalSectionLocker(wxCriticalSection& critsect)
+ : m_critsect(critsect), m_locked(memSectionOk) { if(m_locked) m_critsect.Enter(); }
+ inline ~MemoryCriticalSectionLocker() { if(m_locked) m_critsect.Leave(); }
+
+private:
+ // no assignment operator nor copy ctor
+ MemoryCriticalSectionLocker(const MemoryCriticalSectionLocker&);
+ MemoryCriticalSectionLocker& operator=(const MemoryCriticalSectionLocker&);
+
+ wxCriticalSection& m_critsect;
+ bool m_locked;
+};
+
+static MemoryCriticalSection memLocker;
+
+#endif // USE_THREADSAFE_MEMORY_ALLOCATION
+
+
+#if !(defined(__WINDOWS__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)))
+#if wxUSE_GLOBAL_MEMORY_OPERATORS
+void * operator new (size_t size, wxChar * fileName, int lineNum)
+{
+ return wxDebugAlloc(size, fileName, lineNum, false, false);