From 648603aa7c5f485182a5e2c983403f5cefb1c39a Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 7 Jul 2010 13:03:20 +0200 Subject: sb126: #i107490# cppu lifecycle cleanup (patch by cmc, plus removal of now obsolete CPPU_LEAK_STATIC_DATA) --- cppu/source/uno/lbenv.cxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'cppu/source/uno') diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx index 21d16c5b9148..f9e382d7e7a5 100644 --- a/cppu/source/uno/lbenv.cxx +++ b/cppu/source/uno/lbenv.cxx @@ -139,6 +139,7 @@ struct EnvironmentsData ::osl::Mutex mutex; OUString2EnvironmentMap aName2EnvMap; + EnvironmentsData() : isDisposing(false) {} ~EnvironmentsData(); inline void getEnvironment( @@ -147,6 +148,8 @@ struct EnvironmentsData inline void getRegisteredEnvironments( uno_Environment *** pppEnvs, sal_Int32 * pnLen, uno_memAlloc memAlloc, const OUString & rEnvDcp ); + + bool isDisposing; }; namespace @@ -595,9 +598,14 @@ static void SAL_CALL defenv_harden( *ppHardEnv = 0; } + EnvironmentsData & rData = theEnvironmentsData::get(); + + if (rData.isDisposing) + return; + uno_DefaultEnvironment * that = (uno_DefaultEnvironment *)pEnv; { - ::osl::MutexGuard guard( theEnvironmentsData::get().mutex ); + ::osl::MutexGuard guard( rData.mutex ); if (1 == ::osl_incrementInterlockedCount( &that->nRef )) // is dead { that->nRef = 0; @@ -914,6 +922,7 @@ static void SAL_CALL unoenv_releaseInterface( EnvironmentsData::~EnvironmentsData() { ::osl::MutexGuard guard( mutex ); + isDisposing = true; for ( OUString2EnvironmentMap::const_iterator iPos( aName2EnvMap.begin() ); iPos != aName2EnvMap.end(); ++iPos ) @@ -928,11 +937,7 @@ EnvironmentsData::~EnvironmentsData() #if OSL_DEBUG_LEVEL > 1 ::uno_dumpEnvironment( 0, pHard, 0 ); #endif -#if defined CPPU_LEAK_STATIC_DATA - pHard->environmentDisposing = 0; // set to null => wont be called -#else (*pHard->dispose)( pHard ); // send explicit dispose -#endif (*pHard->release)( pHard ); } } -- cgit v1.2.3 From 17be18e8a505afe4ddb6b7e2278d698554edd884 Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 10 Jan 2011 14:57:31 +0100 Subject: sb139: #i103789# various OSL_DEBUG_LEVEL>1 problems in uno/data.cxx --- cppu/source/uno/data.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'cppu/source/uno') diff --git a/cppu/source/uno/data.cxx b/cppu/source/uno/data.cxx index 5b29637b581b..bb2869ca037f 100644 --- a/cppu/source/uno/data.cxx +++ b/cppu/source/uno/data.cxx @@ -28,6 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_cppu.hxx" +#include +#include + #include "cppu/macros.hxx" #include "osl/mutex.hxx" @@ -350,8 +353,6 @@ sal_Bool SAL_CALL uno_type_isAssignableFromData( #if OSL_DEBUG_LEVEL > 1 -#include - #if defined( SAL_W32) #pragma pack(push, 8) #elif defined(SAL_OS2) @@ -364,12 +365,12 @@ sal_Bool SAL_CALL uno_type_isAssignableFromData( #define MAX_ALIGNMENT_4 #endif -#define OFFSET_OF( s, m ) ((sal_Size)((char *)&((s *)16)->m -16)) +#define OFFSET_OF( s, m ) reinterpret_cast< std::size_t >((char *)&((s *)16)->m -16) #define BINTEST_VERIFY( c ) \ - if (! (c)) { fprintf( stderr, "### binary compatibility test failed: " #c " [line %d]!!!\n", __LINE__ ); abort(); } + if (! (c)) { fprintf( stderr, "### binary compatibility test failed: %s [line %d]!!!\n", #c, __LINE__ ); abort(); } #define BINTEST_VERIFYOFFSET( s, m, n ) \ - if (OFFSET_OF(s, m) != n) { fprintf( stderr, "### OFFSET_OF(" #s ", " #m ") = %d instead of expected %d!!!\n", OFFSET_OF(s, m), n ); abort(); } + if (OFFSET_OF(s, m) != n) { fprintf( stderr, "### OFFSET_OF(" #s ", " #m ") = %" SAL_PRI_SIZET "u instead of expected %d!!!\n", OFFSET_OF(s, m), n ); abort(); } #if OSL_DEBUG_LEVEL > 1 #if defined(__GNUC__) && (defined(LINUX) || defined(FREEBSD)) && (defined(INTEL) || defined(POWERPC) || defined(X86_64) || defined(S390)) -- cgit v1.2.3