From 5302330cfd797d0ba4fd5ca4db9da05d83f62bda Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 23 Jun 2010 11:07:00 +0200 Subject: sb126: #i109853# no need to set CPPU_ENV in cppu/inc/uno/lbnames.h --- cppu/inc/uno/lbnames.h | 45 --------------------------------------------- 1 file changed, 45 deletions(-) (limited to 'cppu') diff --git a/cppu/inc/uno/lbnames.h b/cppu/inc/uno/lbnames.h index da12caa1e276..4bca6a8a9dd5 100644 --- a/cppu/inc/uno/lbnames.h +++ b/cppu/inc/uno/lbnames.h @@ -29,49 +29,6 @@ #ifdef __cplusplus -/* environment type names for supported compilers */ -#if defined (_MSC_VER) -#if (_MSC_VER < 1000) -#error "ms visual c++ version must be at least 4.2" -#elif (_MSC_VER < 1100) // MSVC 4.x -#pragma warning( disable: 4290 ) -#define TMP_CPPU_ENV msci -#elif (_MSC_VER < 1600) // MSVC 5-9 -#define TMP_CPPU_ENV msci -#else -#error "ms visual c++ version must be between 4.2 and 9.x" -#endif /* (_MSC_VER < 1000) */ -/* sunpro cc */ -#elif defined (__SUNPRO_CC) -#if ((__SUNPRO_CC >= 0x5000 && __SUNPRO_CC < 0x6000) || (__SUNPRO_CC >= 0x500 && __SUNPRO_CC < 0x600)) -#define TMP_CPPU_ENV sunpro5 -#elif -#error "sunpro cc version must be 5.x" -provoking error here, because PP ignores #error -#endif /* defined (__SUNPRO_CC) */ -/* g++ 2.x, 3.0 */ -#elif defined (__GNUC__) -#if (__GNUC__ == 2 && __GNUC_MINOR__ == 91) -#define TMP_CPPU_ENV gcc2 -#elif (__GNUC__ == 2 && __GNUC_MINOR__ == 95) -#define TMP_CPPU_ENV gcc2 -#elif (__GNUC__ == 2) -#error "Tested gcc 2 versions are 2.91 and 2.95. Patch uno/lbnames.h to try your gcc 2 version." -#elif (__GNUC__ == 3 && __GNUC_MINOR__ <= 4) -#define __CPPU_ENV gcc3 -#elif (__GNUC__ == 4 && __GNUC_MINOR__ <= 4) -#define __CPPU_ENV gcc3 -#elif (__GNUC__ == 3) -#error "Tested gcc 3 version is <= 3.4. Patch uno/lbnames.h to try your gcc 3 version." -#else -#error "Supported gcc majors are 2 , 3 and 4 <= 4.4. Unsupported gcc major version." -#endif /* defined (__GNUC__) */ -#endif /* defined (_MSC_VER) */ - -#if (! defined (CPPU_ENV) && defined (TMP_CPPU_ENV)) -#define CPPU_ENV TMP_CPPU_ENV -#endif - #ifdef CPPU_ENV #define CPPU_STRINGIFY_EX( x ) #x @@ -87,8 +44,6 @@ provoking error here, because PP ignores #error #endif /* CPPU_ENV */ -#undef TMP_CPPU_ENV - #endif /* __cplusplus */ /** Environment type name for binary C UNO. */ -- cgit 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/threadpool/current.cxx | 4 +-- cppu/source/threadpool/jobqueue.cxx | 3 +- cppu/source/threadpool/jobqueue.hxx | 6 ++++ cppu/source/threadpool/thread.cxx | 32 ++++++++++--------- cppu/source/threadpool/thread.hxx | 5 ++- cppu/source/threadpool/threadpool.cxx | 58 +++++++++++++++++++---------------- cppu/source/threadpool/threadpool.hxx | 15 +++++++-- cppu/source/typelib/static_types.cxx | 48 ++++++++--------------------- cppu/source/typelib/typelib.cxx | 10 ------ cppu/source/uno/lbenv.cxx | 15 ++++++--- cppu/util/target.pmk | 9 ------ 11 files changed, 96 insertions(+), 109 deletions(-) (limited to 'cppu') diff --git a/cppu/source/threadpool/current.cxx b/cppu/source/threadpool/current.cxx index db814a50991b..23bd52ca1917 100644 --- a/cppu/source/threadpool/current.cxx +++ b/cppu/source/threadpool/current.cxx @@ -106,11 +106,9 @@ static typelib_InterfaceTypeDescription * get_type_XCurrentContext() 1, aParameters, 1, pExceptions ); typelib_typedescription_register( (typelib_TypeDescription**)&pMethod ); typelib_typedescription_release( (typelib_TypeDescription*)pMethod ); -#if ! defined CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++reinterpret_cast< typelib_TypeDescription * >( pTD )-> nStaticRefCount; -#endif s_type_XCurrentContext = pTD; } } diff --git a/cppu/source/threadpool/jobqueue.cxx b/cppu/source/threadpool/jobqueue.cxx index 2604af98dee4..6029505fe4ee 100644 --- a/cppu/source/threadpool/jobqueue.cxx +++ b/cppu/source/threadpool/jobqueue.cxx @@ -42,6 +42,7 @@ namespace cppu_threadpool { m_cndWait( osl_createCondition() ) { osl_resetCondition( m_cndWait ); + m_DisposedCallerAdmin = DisposedCallerAdmin::getInstance(); } JobQueue::~JobQueue() @@ -68,7 +69,7 @@ namespace cppu_threadpool { { // synchronize with the dispose calls MutexGuard guard( m_mutex ); - if( DisposedCallerAdmin::getInstance()->isDisposed( nDisposeId ) ) + if( m_DisposedCallerAdmin->isDisposed( nDisposeId ) ) { return 0; } diff --git a/cppu/source/threadpool/jobqueue.hxx b/cppu/source/threadpool/jobqueue.hxx index 5f610b4a2fce..78202573403e 100644 --- a/cppu/source/threadpool/jobqueue.hxx +++ b/cppu/source/threadpool/jobqueue.hxx @@ -34,6 +34,8 @@ #include #include +#include + namespace cppu_threadpool { extern "C" typedef void (SAL_CALL RequestFun)(void *); @@ -48,6 +50,9 @@ namespace cppu_threadpool typedef ::std::list < sal_Int64 > CallStackList; + class DisposedCallerAdmin; + typedef boost::shared_ptr DisposedCallerAdminHolder; + class JobQueue { public: @@ -73,6 +78,7 @@ namespace cppu_threadpool sal_Int32 m_nToDo; sal_Bool m_bSuspended; oslCondition m_cndWait; + DisposedCallerAdminHolder m_DisposedCallerAdmin; }; } diff --git a/cppu/source/threadpool/thread.cxx b/cppu/source/threadpool/thread.cxx index b043dd4e907a..00c91500d1e5 100644 --- a/cppu/source/threadpool/thread.cxx +++ b/cppu/source/threadpool/thread.cxx @@ -31,6 +31,8 @@ #include #include +#include + #include "thread.hxx" #include "jobqueue.hxx" #include "threadpool.hxx" @@ -98,20 +100,17 @@ namespace cppu_threadpool { } while( pCurrent ); } - ThreadAdmin* ThreadAdmin::getInstance() + struct theThreadAdmin : public rtl::StaticWithInit< ThreadAdminHolder, theThreadAdmin > { - static ThreadAdmin *pThreadAdmin = 0; - if( ! pThreadAdmin ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( ! pThreadAdmin ) - { - static ThreadAdmin admin; - pThreadAdmin = &admin; - } + ThreadAdminHolder operator () () { + ThreadAdminHolder aRet(new ThreadAdmin()); + return aRet; } - return pThreadAdmin; + }; + ThreadAdminHolder& ThreadAdmin::getInstance() + { + return theThreadAdmin::get(); } // ---------------------------------------------------------------------------------- @@ -119,12 +118,13 @@ namespace cppu_threadpool { const ByteSequence &aThreadId, sal_Bool bAsynchron ) : m_thread( 0 ) + , m_aThreadAdmin( ThreadAdmin::getInstance() ) , m_pQueue( pQueue ) , m_aThreadId( aThreadId ) , m_bAsynchron( bAsynchron ) , m_bDeleteSelf( sal_True ) { - ThreadAdmin::getInstance()->add( this ); + m_aThreadAdmin->add( this ); } @@ -166,7 +166,7 @@ namespace cppu_threadpool { void ORequestThread::onTerminated() { - ThreadAdmin::getInstance()->remove( this ); + m_aThreadAdmin->remove( this ); if( m_bDeleteSelf ) { delete this; @@ -175,6 +175,8 @@ namespace cppu_threadpool { void ORequestThread::run() { + ThreadPoolHolder theThreadPool = cppu_threadpool::ThreadPool::getInstance(); + while ( m_pQueue ) { if( ! m_bAsynchron ) @@ -197,7 +199,7 @@ namespace cppu_threadpool { if( m_pQueue->isEmpty() ) { - ThreadPool::getInstance()->revokeQueue( m_aThreadId , m_bAsynchron ); + theThreadPool->revokeQueue( m_aThreadId , m_bAsynchron ); // Note : revokeQueue might have failed because m_pQueue.isEmpty() // may be false (race). } @@ -211,7 +213,7 @@ namespace cppu_threadpool { uno_releaseIdFromCurrentThread(); } - cppu_threadpool::ThreadPool::getInstance()->waitInPool( this ); + theThreadPool->waitInPool( this ); } } } diff --git a/cppu/source/threadpool/thread.hxx b/cppu/source/threadpool/thread.hxx index 639f26c5339b..2f7791daf7e5 100644 --- a/cppu/source/threadpool/thread.hxx +++ b/cppu/source/threadpool/thread.hxx @@ -37,6 +37,8 @@ namespace cppu_threadpool { class JobQueue; + class ThreadAdmin; + typedef boost::shared_ptr ThreadAdminHolder; //----------------------------------------- // private thread class for the threadpool @@ -61,6 +63,7 @@ namespace cppu_threadpool { private: oslThread m_thread; + ThreadAdminHolder m_aThreadAdmin; JobQueue *m_pQueue; ::rtl::ByteSequence m_aThreadId; sal_Bool m_bAsynchron; @@ -71,7 +74,7 @@ namespace cppu_threadpool { { public: ~ThreadAdmin (); - static ThreadAdmin *getInstance(); + static ThreadAdminHolder &getInstance(); void add( ORequestThread * ); void remove( ORequestThread * ); void join(); diff --git a/cppu/source/threadpool/threadpool.cxx b/cppu/source/threadpool/threadpool.cxx index accf585957f8..b7df159a80b9 100644 --- a/cppu/source/threadpool/threadpool.cxx +++ b/cppu/source/threadpool/threadpool.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include @@ -44,19 +45,17 @@ using namespace ::osl; namespace cppu_threadpool { - DisposedCallerAdmin *DisposedCallerAdmin::getInstance() + struct theDisposedCallerAdmin : + public rtl::StaticWithInit< DisposedCallerAdminHolder, theDisposedCallerAdmin > { - static DisposedCallerAdmin *pDisposedCallerAdmin = 0; - if( ! pDisposedCallerAdmin ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( ! pDisposedCallerAdmin ) - { - static DisposedCallerAdmin admin; - pDisposedCallerAdmin = &admin; - } + DisposedCallerAdminHolder operator () () { + return DisposedCallerAdminHolder(new DisposedCallerAdmin()); } - return pDisposedCallerAdmin; + }; + + DisposedCallerAdminHolder DisposedCallerAdmin::getInstance() + { + return theDisposedCallerAdmin::get(); } DisposedCallerAdmin::~DisposedCallerAdmin() @@ -107,6 +106,21 @@ namespace cppu_threadpool //------------------------------------------------------------------------------- + + struct theThreadPool : + public rtl::StaticWithInit< ThreadPoolHolder, theThreadPool > + { + ThreadPoolHolder operator () () { + ThreadPoolHolder aRet(new ThreadPool()); + return aRet; + } + }; + + ThreadPool::ThreadPool() + { + m_DisposedCallerAdmin = DisposedCallerAdmin::getInstance(); + } + ThreadPool::~ThreadPool() { #if OSL_DEBUG_LEVEL > 1 @@ -116,19 +130,9 @@ namespace cppu_threadpool } #endif } - ThreadPool *ThreadPool::getInstance() + ThreadPoolHolder ThreadPool::getInstance() { - static ThreadPool *pThreadPool = 0; - if( ! pThreadPool ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( ! pThreadPool ) - { - static ThreadPool pool; - pThreadPool = &pool; - } - } - return pThreadPool; + return theThreadPool::get(); } @@ -136,7 +140,7 @@ namespace cppu_threadpool { if( nDisposeId ) { - DisposedCallerAdmin::getInstance()->dispose( nDisposeId ); + m_DisposedCallerAdmin->dispose( nDisposeId ); MutexGuard guard( m_mutex ); for( ThreadIdHashMap::iterator ii = m_mapQueue.begin() ; @@ -171,7 +175,7 @@ namespace cppu_threadpool void ThreadPool::stopDisposing( sal_Int64 nDisposeId ) { - DisposedCallerAdmin::getInstance()->stopDisposing( nDisposeId ); + m_DisposedCallerAdmin->stopDisposing( nDisposeId ); } /****************** @@ -400,7 +404,7 @@ struct uno_ThreadPool_Hash -typedef ::std::hash_set< uno_ThreadPool, uno_ThreadPool_Hash, uno_ThreadPool_Equal > ThreadpoolHashSet; +typedef ::std::hash_map< uno_ThreadPool, ThreadPoolHolder, uno_ThreadPool_Hash, uno_ThreadPool_Equal > ThreadpoolHashSet; static ThreadpoolHashSet *g_pThreadpoolHashSet; @@ -420,7 +424,7 @@ uno_threadpool_create() SAL_THROW_EXTERN_C() // Just ensure that the handle is unique in the process (via heap) uno_ThreadPool h = new struct _uno_ThreadPool; - g_pThreadpoolHashSet->insert( h ); + g_pThreadpoolHashSet->insert( ThreadpoolHashSet::value_type(h, ThreadPool::getInstance()) ); return h; } diff --git a/cppu/source/threadpool/threadpool.hxx b/cppu/source/threadpool/threadpool.hxx index cb580eaf92a2..e1c9a127fa55 100644 --- a/cppu/source/threadpool/threadpool.hxx +++ b/cppu/source/threadpool/threadpool.hxx @@ -30,6 +30,8 @@ #include +#include + #include "jobqueue.hxx" @@ -76,12 +78,15 @@ namespace cppu_threadpool { typedef ::std::list < struct ::cppu_threadpool::WaitingThread * > WaitingThreadList; + class DisposedCallerAdmin; + typedef boost::shared_ptr DisposedCallerAdminHolder; + class DisposedCallerAdmin { public: ~DisposedCallerAdmin(); - static DisposedCallerAdmin *getInstance(); + static DisposedCallerAdminHolder getInstance(); void dispose( sal_Int64 nDisposeId ); void stopDisposing( sal_Int64 nDisposeId ); @@ -92,11 +97,15 @@ namespace cppu_threadpool { DisposedCallerList m_lst; }; + class ThreadPool; + typedef boost::shared_ptr ThreadPoolHolder; + class ThreadPool { public: + ThreadPool(); ~ThreadPool(); - static ThreadPool *getInstance(); + static ThreadPoolHolder getInstance(); void dispose( sal_Int64 nDisposeId ); void stopDisposing( sal_Int64 nDisposeId ); @@ -124,6 +133,8 @@ namespace cppu_threadpool { ::osl::Mutex m_mutexWaitingThreadList; WaitingThreadList m_lstThreads; + + DisposedCallerAdminHolder m_DisposedCallerAdmin; }; } // end namespace cppu_threadpool diff --git a/cppu/source/typelib/static_types.cxx b/cppu/source/typelib/static_types.cxx index 5f1bbaad514a..605bc5aadbdc 100644 --- a/cppu/source/typelib/static_types.cxx +++ b/cppu/source/typelib/static_types.cxx @@ -168,10 +168,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( OUString sTypeName( RTL_CONSTASCII_USTRINGPARAM("type") ); ::typelib_typedescriptionreference_new( &s_aTypes[typelib_TypeClass_TYPE], typelib_TypeClass_TYPE, sTypeName.pData ); -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++s_aTypes[typelib_TypeClass_TYPE]->nStaticRefCount; -#endif } // any if (! s_aTypes[typelib_TypeClass_ANY]) @@ -179,10 +177,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( OUString sTypeName( RTL_CONSTASCII_USTRINGPARAM("any") ); ::typelib_typedescriptionreference_new( &s_aTypes[typelib_TypeClass_ANY], typelib_TypeClass_ANY, sTypeName.pData ); -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++s_aTypes[typelib_TypeClass_ANY]->nStaticRefCount; -#endif } // string if (! s_aTypes[typelib_TypeClass_STRING]) @@ -190,10 +186,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( OUString sTypeName( RTL_CONSTASCII_USTRINGPARAM("string") ); ::typelib_typedescriptionreference_new( &s_aTypes[typelib_TypeClass_STRING], typelib_TypeClass_STRING, sTypeName.pData ); -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++s_aTypes[typelib_TypeClass_STRING]->nStaticRefCount; -#endif } // XInterface if (! s_aTypes[typelib_TypeClass_INTERFACE]) @@ -220,10 +214,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( ::typelib_typedescription_register( (typelib_TypeDescription **)&pTD ); ::typelib_typedescriptionreference_acquire( s_aTypes[typelib_TypeClass_INTERFACE] = ((typelib_TypeDescription *)pTD)->pWeakRef ); -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++s_aTypes[typelib_TypeClass_INTERFACE]->nStaticRefCount; -#endif ::typelib_typedescription_release( (typelib_TypeDescription*)pTD ); ::typelib_typedescriptionreference_release( pMembers[0] ); @@ -252,10 +244,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( typelib_typedescription_register( &pTD1 ); typelib_typedescriptionreference_acquire( s_aTypes[typelib_TypeClass_EXCEPTION] = pTD1->pWeakRef ); -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++s_aTypes[typelib_TypeClass_EXCEPTION]->nStaticRefCount; -#endif // RuntimeException OUString sTypeName2( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.RuntimeException") ); ::typelib_typedescription_new( @@ -302,10 +292,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( { OUString aTypeName( OUString::createFromAscii( s_aTypeNames[eTypeClass] ) ); ::typelib_typedescriptionreference_new( &s_aTypes[eTypeClass], eTypeClass, aTypeName.pData ); -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++s_aTypes[eTypeClass]->nStaticRefCount; -#endif } } } @@ -327,10 +315,8 @@ void SAL_CALL typelib_static_type_init( OUString aTypeName( OUString::createFromAscii( pTypeName ) ); ::typelib_typedescriptionreference_new( ppRef, eTypeClass, aTypeName.pData ); -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++((*ppRef)->nStaticRefCount); -#endif } } } @@ -364,10 +350,8 @@ void SAL_CALL typelib_static_sequence_type_init( *ppRef = (typelib_TypeDescriptionReference *)pReg; OSL_ASSERT( *ppRef == pReg->pWeakRef ); } -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++((*ppRef)->nStaticRefCount); -#endif } } } @@ -450,10 +434,8 @@ void init( *ppRef = (typelib_TypeDescriptionReference *)pReg; OSL_ASSERT( *ppRef == pReg->pWeakRef ); } -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++((*ppRef)->nStaticRefCount); -#endif } } } @@ -551,10 +533,8 @@ void SAL_CALL typelib_static_mi_interface_type_init( *ppRef = (typelib_TypeDescriptionReference *)pReg; OSL_ASSERT( *ppRef == pReg->pWeakRef ); } -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++((*ppRef)->nStaticRefCount); -#endif } } } @@ -593,10 +573,8 @@ void SAL_CALL typelib_static_enum_type_init( *ppRef = (typelib_TypeDescriptionReference *)pReg; OSL_ASSERT( *ppRef == pReg->pWeakRef ); } -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++(*(sal_Int32 *)&(*ppRef)->pReserved); -#endif } } } @@ -660,10 +638,8 @@ void SAL_CALL typelib_static_array_type_init( OSL_ASSERT( *ppRef == pReg->pWeakRef ); } else delete [] pDimensions; -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++((*ppRef)->nStaticRefCount); -#endif } } } diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index 7f85d691cce5..bfbb3ff3d162 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -264,17 +264,9 @@ inline void TypeDescriptor_Init_Impl::callChain( } } -// never called -#if defined(CPPU_LEAK_STATIC_DATA) && defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500) -static void dumb_sunpro5_must_have_dtor_stl_hashmap_code_if_compiled_with_minus_g() SAL_THROW( () ) -{ - delete (WeakMap_Impl *)0xbeef1e; -} -#endif //__________________________________________________________________________________________________ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () ) { -#ifndef CPPU_LEAK_STATIC_DATA if( pCache ) { TypeDescriptionList_Impl::const_iterator aIt = pCache->begin(); @@ -355,9 +347,7 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () ) #endif delete pCallbacks; pCallbacks = 0; -#endif // CPPU_LEAK_STATIC_DATA - // todo: maybe into leak block if( pMutex ) { delete pMutex; 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 ); } } diff --git a/cppu/util/target.pmk b/cppu/util/target.pmk index 4e456b20605b..3befcb154753 100644 --- a/cppu/util/target.pmk +++ b/cppu/util/target.pmk @@ -51,12 +51,3 @@ CFLAGS += -Ob0 .ENDIF .ENDIF - -# other stuff - -.IF "$(cppu_no_leak)" == "" -.IF "$(bndchk)" == "" -CFLAGS += -DCPPU_LEAK_STATIC_DATA -.ENDIF -.ENDIF - -- cgit From ce8677050293f93d38e21e3632af01c5de022491 Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 12 Jul 2010 11:44:25 +0200 Subject: sb126: #i107490# dead code not removed by previous cleanup --- cppu/source/typelib/typelib.cxx | 1 - 1 file changed, 1 deletion(-) (limited to 'cppu') diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index bfbb3ff3d162..aa0d18589a89 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -295,7 +295,6 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () ) for( i = 0; i < nSize; i++ ) { typelib_TypeDescriptionReference * pTDR = ppTDR[i]; - sal_Int32 nStaticCounts = pTDR->nStaticRefCount; OSL_ASSERT( pTDR->nRefCount > pTDR->nStaticRefCount ); pTDR->nRefCount -= pTDR->nStaticRefCount; -- cgit From 16813a9d8b461ec6a78373aef29f1d9a74903ef7 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Tue, 13 Jul 2010 18:26:57 +0200 Subject: dr77: #i113097# make Sequence(sal_Int32) explicit --- cppu/inc/com/sun/star/uno/Sequence.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cppu') diff --git a/cppu/inc/com/sun/star/uno/Sequence.h b/cppu/inc/com/sun/star/uno/Sequence.h index da9906533583..71bb42c7413b 100644 --- a/cppu/inc/com/sun/star/uno/Sequence.h +++ b/cppu/inc/com/sun/star/uno/Sequence.h @@ -125,7 +125,7 @@ public: @param len initial sequence length */ - inline Sequence( sal_Int32 len ); + inline explicit Sequence( sal_Int32 len ); /** Destructor: Releases sequence handle. Last handle will destruct elements and free memory. -- cgit From 2a3ed89284890615ad4bce57be55ba558351cde1 Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 25 Oct 2010 15:37:14 +0200 Subject: sb132: #i112448# proper clean up in JobQueue::enter (patch by olistraub) --- cppu/source/threadpool/jobqueue.cxx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cppu') diff --git a/cppu/source/threadpool/jobqueue.cxx b/cppu/source/threadpool/jobqueue.cxx index 6029505fe4ee..333a350c0b23 100644 --- a/cppu/source/threadpool/jobqueue.cxx +++ b/cppu/source/threadpool/jobqueue.cxx @@ -98,6 +98,10 @@ namespace cppu_threadpool { if( 0 == m_lstCallstack.front() ) { // disposed ! + if( m_lstJob.empty() ) + { + osl_resetCondition( m_cndWait ); + } break; } -- cgit 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') 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