summaryrefslogtreecommitdiff
path: root/cppu
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@novell.com>2011-01-23 01:01:28 +0200
committerTor Lillqvist <tlillqvist@novell.com>2011-01-23 01:05:45 +0200
commit48252aada0f12b8cbb8f66bc21d44f770a1229b8 (patch)
tree318f2b8d95b7edd1d37187413935d00cefe4ef79 /cppu
parentfc381c2b2f29e358497b74add9249f86b206c427 (diff)
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.
Diffstat (limited to 'cppu')
-rw-r--r--cppu/source/typelib/typelib.cxx19
-rw-r--r--cppu/util/target.pmk4
2 files changed, 23 insertions, 0 deletions
diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index dbd005a2d680..d46960c97eb5 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -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 )
{
diff --git a/cppu/util/target.pmk b/cppu/util/target.pmk
index 3befcb154753..a94ea7c8dafe 100644
--- a/cppu/util/target.pmk
+++ b/cppu/util/target.pmk
@@ -51,3 +51,7 @@ CFLAGS += -Ob0
.ENDIF
.ENDIF
+
+.IF "$(COM)$(CPU)" == "MSCX"
+CFLAGS += -DCPPU_LEAK_STATIC_DATA
+.ENDIF