If CPPU_LEAK_STATIC_DATA is defined, don't bother with assertions

Re-introduce the possibility to define CPPU_LEAK_STATIC_DATA. This
time use it to bypass just the assertions that check that the type
description counts really are zero at the end of the
TypeDescriptor_Init_Impl destructor.

Add more informative debugging printout of which counts are non-zero.

Define CPPU_LEAK_STATIC_DATA for x64 Windows for now. But we do get
the same assertions also on x86 Windows if cppu is built with
OSL_DEBUG_LEVEL>1.
This commit is contained in:
Tor Lillqvist 2011-01-23 01:01:28 +02:00
parent fc381c2b2f
commit 48252aada0
2 changed files with 23 additions and 0 deletions

View File

@ -29,6 +29,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_cppu.hxx"
#if OSL_DEBUG_LEVEL > 1
#include <stdio.h>
#endif
#include <hash_map>
#include <list>
#include <set>
@ -335,7 +339,21 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () )
delete pWeakMap;
pWeakMap = 0;
}
#ifndef CPPU_LEAK_STATIC_DATA
#if OSL_DEBUG_LEVEL > 1
#define MYASSERT(x) if (x != 0) fprintf(stderr, "### "#x" = %d, should be zero!!!\n", x);
MYASSERT (nTypeDescriptionCount );
MYASSERT( nCompoundTypeDescriptionCount );
MYASSERT( nUnionTypeDescriptionCount );
MYASSERT( nIndirectTypeDescriptionCount );
MYASSERT( nArrayTypeDescriptionCount );
MYASSERT( nEnumTypeDescriptionCount );
MYASSERT( nInterfaceMethodTypeDescriptionCount );
MYASSERT( nInterfaceAttributeTypeDescriptionCount );
MYASSERT( nInterfaceTypeDescriptionCount );
MYASSERT( nTypeDescriptionReferenceCount );
#undef MYASSERT
OSL_ASSERT( nTypeDescriptionCount == 0 );
OSL_ASSERT( nCompoundTypeDescriptionCount == 0 );
OSL_ASSERT( nUnionTypeDescriptionCount == 0 );
@ -351,6 +369,7 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () )
#endif
delete pCallbacks;
pCallbacks = 0;
#endif // CPPU_LEAK_STATIC_DATA
if( pMutex )
{

View File

@ -51,3 +51,7 @@ CFLAGS += -Ob0
.ENDIF
.ENDIF
.IF "$(COM)$(CPU)" == "MSCX"
CFLAGS += -DCPPU_LEAK_STATIC_DATA
.ENDIF