added wxDebugContext::SetShutdownNotifyFunction() (patch 1887210)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51624 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-02-09 23:57:41 +00:00
parent 01c0355483
commit 6dfbea27b9
3 changed files with 47 additions and 7 deletions

View File

@@ -452,6 +452,9 @@ static wxMarkerType markerCalc[2];
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)
{
}
@@ -858,6 +861,11 @@ void wxDebugContext::OutputDumpLine(const wxChar *szFormat, ...)
dbgout.Printf(buf);
}
void wxDebugContext::SetShutdownNotifyFunction(wxShutdownNotifyFunction shutdownFn)
{
sm_shutdownFn = shutdownFn;
}
#if USE_THREADSAFE_MEMORY_ALLOCATION
static bool memSectionOk = false;
@@ -1129,6 +1137,22 @@ void wxTraceLevel(int, const wxChar * ...)
// 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)