// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-/*
- The macro which will be expanded to include the file and line number
- info, or to be a straight call to the new operator.
-*/
-
-#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
+#if wxUSE_MEMORY_TRACING || wxUSE_DEBUG_CONTEXT
WXDLLIMPEXP_BASE void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, bool isVect = false);
WXDLLIMPEXP_BASE void wxDebugFree(void * buf, bool isVect = false);
WXDLLIMPEXP_BASE void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, bool isVect = false);
WXDLLIMPEXP_BASE void wxDebugFree(void * buf, bool isVect = false);
#if defined(__WXMSW__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE))
inline void * operator new (size_t size, wxChar * fileName, int lineNum)
{
#if defined(__WXMSW__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE))
inline void * operator new (size_t size, wxChar * fileName, int lineNum)
{
- return wxDebugAlloc(size, fileName, lineNum, FALSE, FALSE);
+ return wxDebugAlloc(size, fileName, lineNum, false, false);
- return wxDebugAlloc(size, NULL, 0, FALSE);
+ return wxDebugAlloc(size, NULL, 0, false);
- return wxDebugAlloc(size, NULL, 0, FALSE, TRUE);
+ return wxDebugAlloc(size, NULL, 0, false, true);
- return wxDebugAlloc(size, fileName, lineNum, FALSE, TRUE);
+ return wxDebugAlloc(size, fileName, lineNum, false, true);
// This function is used to output the dump
static void OutputDumpLine(const wxChar *szFormat, ...);
// This function is used to output the dump
static void OutputDumpLine(const wxChar *szFormat, ...);
// Set to false if we're not checking all previous nodes when
// we do a new. Set to true when we are.
static bool m_checkPrevious;
// Set to false if we're not checking all previous nodes when
// we do a new. Set to true when we are.
static bool m_checkPrevious;
+
+ // Holds a pointer to an optional application function to call at shutdown.
+ static wxShutdownNotifyFunction sm_shutdownFn;
+
+ // Have to access our shutdown hook
+ friend class wxDebugContextDumpDelayCounter;
};
// Final cleanup (e.g. deleting the log object and doing memory leak checking)
// will be delayed until all wxDebugContextDumpDelayCounter objects have been
// destructed. Adding one wxDebugContextDumpDelayCounter per file will delay
// memory leak checking until after destructing all global objects.
};
// Final cleanup (e.g. deleting the log object and doing memory leak checking)
// will be delayed until all wxDebugContextDumpDelayCounter objects have been
// destructed. Adding one wxDebugContextDumpDelayCounter per file will delay
// memory leak checking until after destructing all global objects.
- wxDebugContextDumpDelayCounter() {
- sm_count++;
- }
-
- ~wxDebugContextDumpDelayCounter() {
- sm_count--;
- if(!sm_count) DoDump();
- }
+ wxDebugContextDumpDelayCounter();
+ ~wxDebugContextDumpDelayCounter();
+
static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_Extra;
// Output a debug message, in a system dependent fashion.
static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_Extra;
// Output a debug message, in a system dependent fashion.
-void WXDLLIMPEXP_BASE wxTrace(const wxChar *fmt ...) ATTRIBUTE_PRINTF_1;
-void WXDLLIMPEXP_BASE wxTraceLevel(int level, const wxChar *fmt ...) ATTRIBUTE_PRINTF_2;
+void WXDLLIMPEXP_BASE wxTrace(const wxChar *fmt ...) WX_ATTRIBUTE_PRINTF_1;
+void WXDLLIMPEXP_BASE wxTraceLevel(int level, const wxChar *fmt ...) WX_ATTRIBUTE_PRINTF_2;