#include "wx/ioswrap.h"
#if !defined(__WATCOMC__) && !(defined(__VMS__) && ( __VMS_VER < 70000000 ) )\
- && !defined( __MWERKS__ ) && !defined(__SALFORDC__)
+ && !defined( __MWERKS__ )
#include <memory.h>
#endif
msg2.Printf(wxT(" at 0x%lX, size %d"), (long)GetActualData(), (int)RequestSize());
msg += msg2;
- wxDebugContext::OutputDumpLine(msg);
+ wxDebugContext::OutputDumpLine(msg.c_str());
}
else
{
wxString msg2;
msg2.Printf(wxT("non-object data at 0x%lX, size %d"), (long)GetActualData(), (int)RequestSize() );
msg += msg2;
- wxDebugContext::OutputDumpLine(msg);
+ wxDebugContext::OutputDumpLine(msg.c_str());
}
}
int wxDebugContext::m_balign = (int)((char *)&markerCalc[1] - (char*)&markerCalc[0]);
int wxDebugContext::m_balignmask = (int)((char *)&markerCalc[1] - (char*)&markerCalc[0]) - 1;
+// Pointer to global function to call at shutdown
+wxShutdownNotifyFunction wxDebugContext::sm_shutdownFn;
+
wxDebugContext::wxDebugContext(void)
{
}
{
#ifdef __WXDEBUG__
{
- wxChar* appName = (wxChar*) wxT("application");
+ const wxChar* appName = wxT("application");
wxString appNameStr;
if (wxTheApp)
{
appNameStr = wxTheApp->GetAppName();
- appName = WXSTRINGCAST appNameStr;
- OutputDumpLine(wxT("----- Memory dump of %s at %s -----"), appName, WXSTRINGCAST wxNow() );
+ appName = appNameStr.c_str();
+ OutputDumpLine(wxT("----- Memory dump of %s at %s -----"), appName, static_cast<const wxChar *>(wxNow().c_str()));
}
else
{
{
#ifdef __WXDEBUG__
{
- wxChar* appName = (wxChar*) wxT("application");
+ const wxChar* appName = wxT("application");
wxString appNameStr;
if (wxTheApp)
{
appNameStr = wxTheApp->GetAppName();
- appName = WXSTRINGCAST appNameStr;
- OutputDumpLine(wxT("----- Memory statistics of %s at %s -----"), appName, WXSTRINGCAST wxNow() );
+ appName = appNameStr.c_str();
+ OutputDumpLine(wxT("----- Memory statistics of %s at %s -----"), appName, static_cast<const wxChar *>(wxNow().c_str()));
}
else
{
bool wxDebugContext::PrintClasses(void)
{
{
- wxChar* appName = (wxChar*) wxT("application");
+ const wxChar* appName = wxT("application");
wxString appNameStr;
if (wxTheApp)
{
appNameStr = wxTheApp->GetAppName();
- appName = WXSTRINGCAST appNameStr;
+ appName = appNameStr.c_str();
wxLogMessage(wxT("----- Classes in %s -----"), appName);
}
}
dbgout.Printf(buf);
}
+void wxDebugContext::SetShutdownNotifyFunction(wxShutdownNotifyFunction shutdownFn)
+{
+ sm_shutdownFn = shutdownFn;
+}
+
#if USE_THREADSAFE_MEMORY_ALLOCATION
static bool memSectionOk = false;
// All global variables are initialized to 0 at the very beginning, and this is just fine.
int wxDebugContextDumpDelayCounter::sm_count;
+wxDebugContextDumpDelayCounter::wxDebugContextDumpDelayCounter()
+{
+ sm_count++;
+}
+
+wxDebugContextDumpDelayCounter::~wxDebugContextDumpDelayCounter()
+{
+ if ( !--sm_count )
+ {
+ // Notify app if we've been asked to do that
+ if( wxDebugContext::sm_shutdownFn )
+ wxDebugContext::sm_shutdownFn();
+ DoDump();
+ }
+}
+
void wxDebugContextDumpDelayCounter::DoDump()
{
if (wxDebugContext::CountObjectsLeft(true) > 0)