8076325
--- cppu/source/threadpool/jobqueue.cxx	2008-04-11 11:33:02.000000000 +0100
8076325
+++ cppu/source/threadpool/jobqueue.cxx	2009-12-02 16:14:26.000000000 +0000
8076325
@@ -45,6 +45,7 @@
8076325
 		m_cndWait( osl_createCondition() )
8076325
 	{
8076325
 		osl_resetCondition( m_cndWait );		
8076325
+		m_DisposedCallerAdmin = DisposedCallerAdmin::getInstance();
8076325
 	}
8076325
 	
8076325
 	JobQueue::~JobQueue()
8076325
@@ -71,7 +72,7 @@
8076325
 		{
8076325
 			// synchronize with the dispose calls
8076325
 			MutexGuard guard( m_mutex );
8076325
-			if( DisposedCallerAdmin::getInstance()->isDisposed( nDisposeId ) )
8076325
+			if( m_DisposedCallerAdmin->isDisposed( nDisposeId ) )
8076325
 			{
8076325
 				return 0;
8076325
 			}
8076325
--- cppu/source/threadpool/jobqueue.hxx	2008-04-11 11:33:18.000000000 +0100
8076325
+++ cppu/source/threadpool/jobqueue.hxx	2009-12-02 16:15:49.000000000 +0000
8076325
@@ -37,6 +37,8 @@
8076325
 #include <osl/conditn.h>
8076325
 #include <osl/mutex.hxx>
8076325
 
8076325
+#include <boost/shared_ptr.hpp>
8076325
+
8076325
 namespace cppu_threadpool
8076325
 {
8076325
     extern "C" typedef void (SAL_CALL RequestFun)(void *);
8076325
@@ -51,6 +53,9 @@
8076325
 
8076325
 	typedef	::std::list	< sal_Int64 > CallStackList;
8076325
 
8076325
+	class DisposedCallerAdmin;
8076325
+	typedef boost::shared_ptr<DisposedCallerAdmin> DisposedCallerAdminHolder;
8076325
+
8076325
 	class JobQueue
8076325
 	{
8076325
 	public:
8076325
@@ -76,6 +81,7 @@
8076325
 		sal_Int32 m_nToDo;
8076325
 		sal_Bool m_bSuspended;
8076325
 		oslCondition m_cndWait;
8076325
+		DisposedCallerAdminHolder m_DisposedCallerAdmin;
8076325
 	};
8076325
 }
8076325
 
8076325
--- cppu/source/threadpool/thread.cxx	2008-04-11 11:34:00.000000000 +0100
8076325
+++ cppu/source/threadpool/thread.cxx	2009-12-03 16:15:02.000000000 +0000
8076325
@@ -31,6 +31,8 @@
8076325
 #include <osl/diagnose.h>
8076325
 #include <uno/threadpool.h>
8076325
 
8076325
+#include <rtl/instance.hxx>
8076325
+
8076325
 #include "thread.hxx"
8076325
 #include "jobqueue.hxx"
8076325
 #include "threadpool.hxx"
8076325
@@ -98,20 +100,17 @@
8076325
 		} while( pCurrent );
8076325
 	}
8076325
 
8076325
-	ThreadAdmin* ThreadAdmin::getInstance()
8076325
+	struct theThreadAdmin : public rtl::StaticWithInit< ThreadAdminHolder, theThreadAdmin >
8076325
 	{
8076325
-		static ThreadAdmin *pThreadAdmin = 0;
8076325
-		if( ! pThreadAdmin )
8076325
-		{
8076325
-			MutexGuard guard( Mutex::getGlobalMutex() );
8076325
-			if( ! pThreadAdmin )
8076325
-			{
8076325
-				static ThreadAdmin admin;
8076325
-				pThreadAdmin = &admin;
8076325
-			}
8076325
+		ThreadAdminHolder operator () () {
8076325
+			ThreadAdminHolder aRet(new ThreadAdmin());
8076325
+			return aRet;
8076325
 		}
8076325
-		return pThreadAdmin;
8076325
+	};
8076325
 
8076325
+	ThreadAdminHolder& ThreadAdmin::getInstance()
8076325
+	{
8076325
+		return theThreadAdmin::get();
8076325
 	}
8076325
 
8076325
 // ----------------------------------------------------------------------------------
8076325
@@ -119,12 +118,13 @@
8076325
 									const ByteSequence &aThreadId,
8076325
 									sal_Bool bAsynchron )
8076325
 		: m_thread( 0 )
8076325
+		, m_aThreadAdmin( ThreadAdmin::getInstance() )
8076325
 		, m_pQueue( pQueue )
8076325
 		, m_aThreadId( aThreadId )
8076325
 		, m_bAsynchron( bAsynchron )
8076325
 		, m_bDeleteSelf( sal_True )
8076325
 	{
8076325
-		ThreadAdmin::getInstance()->add( this );
8076325
+		m_aThreadAdmin->add( this );
8076325
 	}
8076325
 
8076325
 
8076325
@@ -166,7 +166,7 @@
8076325
 
8076325
 	void ORequestThread::onTerminated()
8076325
 	{
8076325
-		ThreadAdmin::getInstance()->remove( this );
8076325
+		m_aThreadAdmin->remove( this );
8076325
 		if( m_bDeleteSelf )
8076325
 		{
8076325
 			delete this;
8076325
@@ -175,6 +175,8 @@
8076325
 
8076325
 	void ORequestThread::run()
8076325
 	{
8076325
+		ThreadPoolHolder theThreadPool = cppu_threadpool::ThreadPool::getInstance();
8076325
+
8076325
 		while ( m_pQueue )
8076325
 		{
8076325
 			if( ! m_bAsynchron )
8076325
@@ -197,7 +199,7 @@
8076325
 
8076325
 				if( m_pQueue->isEmpty() )
8076325
 				{
8076325
-					ThreadPool::getInstance()->revokeQueue( m_aThreadId , m_bAsynchron );
8076325
+					theThreadPool->revokeQueue( m_aThreadId , m_bAsynchron );
8076325
 					// Note : revokeQueue might have failed because m_pQueue.isEmpty()
8076325
 					//        may be false (race).
8076325
 				}
8076325
@@ -211,7 +213,7 @@
8076325
 				uno_releaseIdFromCurrentThread();
8076325
 			}
8076325
 
8076325
-			cppu_threadpool::ThreadPool::getInstance()->waitInPool( this );
8076325
+			theThreadPool->waitInPool( this );
8076325
 		}
8076325
 	}
8076325
 }
8076325
--- cppu/source/threadpool/thread.hxx	2008-04-11 11:34:18.000000000 +0100
8076325
+++ cppu/source/threadpool/thread.hxx	2009-12-02 15:58:34.000000000 +0000
8076325
@@ -37,6 +37,8 @@
8076325
 namespace cppu_threadpool {
8076325
 
8076325
 	class JobQueue;
8076325
+	class ThreadAdmin;
8076325
+	typedef boost::shared_ptr<ThreadAdmin> ThreadAdminHolder;
8076325
 	
8076325
     //-----------------------------------------
8076325
     // private thread class for the threadpool
8076325
@@ -61,6 +63,7 @@
8076325
 		
8076325
 	private:
8076325
 		oslThread m_thread;
8076325
+		ThreadAdminHolder m_aThreadAdmin;
8076325
 		JobQueue *m_pQueue;
8076325
 		::rtl::ByteSequence m_aThreadId;
8076325
 		sal_Bool m_bAsynchron;
8076325
@@ -71,7 +74,7 @@
8076325
 	{
8076325
 	public:
8076325
 		~ThreadAdmin ();
8076325
-		static ThreadAdmin *getInstance();
8076325
+		static ThreadAdminHolder &getInstance();
8076325
 		void add( ORequestThread * );
8076325
 		void remove( ORequestThread * );
8076325
 		void join();
8076325
--- cppu/source/threadpool/threadpool.cxx	2008-04-11 11:34:54.000000000 +0100
8076325
+++ cppu/source/threadpool/threadpool.cxx	2009-12-03 16:14:56.000000000 +0000
8076325
@@ -33,6 +33,7 @@
8076325
 #include <osl/diagnose.h>
8076325
 #include <osl/mutex.hxx>
8076325
 #include <osl/thread.h>
8076325
+#include <rtl/instance.hxx>
8076325
 
8076325
 #include <uno/threadpool.h>
8076325
 
8076325
@@ -44,19 +45,17 @@
8076325
 
8076325
 namespace cppu_threadpool
8076325
 {
8076325
-	DisposedCallerAdmin *DisposedCallerAdmin::getInstance()
8076325
+	struct theDisposedCallerAdmin :
8076325
+		public rtl::StaticWithInit< DisposedCallerAdminHolder, theDisposedCallerAdmin >
8076325
 	{
8076325
-		static DisposedCallerAdmin *pDisposedCallerAdmin = 0;
8076325
-		if( ! pDisposedCallerAdmin )
8076325
-		{
8076325
-			MutexGuard guard( Mutex::getGlobalMutex() );
8076325
-			if( ! pDisposedCallerAdmin )
8076325
-			{
8076325
-				static DisposedCallerAdmin admin;
8076325
-				pDisposedCallerAdmin = &admin;
8076325
-			}
8076325
+		DisposedCallerAdminHolder operator () () {
8076325
+			return DisposedCallerAdminHolder(new DisposedCallerAdmin());
8076325
 		}
8076325
-		return pDisposedCallerAdmin;
8076325
+	};
8076325
+
8076325
+	DisposedCallerAdminHolder DisposedCallerAdmin::getInstance()
8076325
+	{
8076325
+		return theDisposedCallerAdmin::get();
8076325
 	}
8076325
 
8076325
 	DisposedCallerAdmin::~DisposedCallerAdmin()
8076325
@@ -107,6 +106,21 @@
8076325
 
8076325
 
8076325
 	//-------------------------------------------------------------------------------
8076325
+
8076325
+	struct theThreadPool :
8076325
+		public rtl::StaticWithInit< ThreadPoolHolder, theThreadPool >
8076325
+	{
8076325
+		ThreadPoolHolder operator () () {
8076325
+			ThreadPoolHolder aRet(new ThreadPool());
8076325
+			return aRet;
8076325
+		}
8076325
+	};
8076325
+
8076325
+	ThreadPool::ThreadPool()
8076325
+	{
8076325
+        	m_DisposedCallerAdmin = DisposedCallerAdmin::getInstance();
8076325
+	}
8076325
+
8076325
 	ThreadPool::~ThreadPool()
8076325
 	{
8076325
 #if OSL_DEBUG_LEVEL > 1
8076325
@@ -116,19 +130,9 @@
8076325
 		}
8076325
 #endif
8076325
 	}
8076325
-	ThreadPool *ThreadPool::getInstance()
8076325
+	ThreadPoolHolder ThreadPool::getInstance()
8076325
 	{
8076325
-		static ThreadPool *pThreadPool = 0;
8076325
-		if( ! pThreadPool )
8076325
-		{
8076325
-			MutexGuard guard( Mutex::getGlobalMutex() );
8076325
-			if( ! pThreadPool )
8076325
-			{
8076325
-				static ThreadPool pool;
8076325
-				pThreadPool = &poo;;
8076325
-			}
8076325
-		}
8076325
-		return pThreadPool;
8076325
+		return theThreadPool::get();
8076325
 	}
8076325
 
8076325
 
8076325
@@ -136,7 +140,7 @@
8076325
 	{
8076325
 		if( nDisposeId )
8076325
 		{
8076325
-			DisposedCallerAdmin::getInstance()->dispose( nDisposeId );
8076325
+			m_DisposedCallerAdmin->dispose( nDisposeId );
8076325
 
8076325
 			MutexGuard guard( m_mutex );
8076325
 			for( ThreadIdHashMap::iterator ii = m_mapQueue.begin() ;
8076325
@@ -171,7 +175,7 @@
8076325
 
8076325
 	void ThreadPool::stopDisposing( sal_Int64 nDisposeId )
8076325
 	{
8076325
-		DisposedCallerAdmin::getInstance()->stopDisposing( nDisposeId );
8076325
+		m_DisposedCallerAdmin->stopDisposing( nDisposeId );
8076325
 	}
8076325
 
8076325
 	/******************
8076325
@@ -400,7 +404,7 @@
8076325
 
8076325
 
8076325
 
8076325
-typedef ::std::hash_set< uno_ThreadPool, uno_ThreadPool_Hash, uno_ThreadPool_Equal > ThreadpoolHashSet;
8076325
+typedef ::std::hash_map< uno_ThreadPool, ThreadPoolHolder, uno_ThreadPool_Hash, uno_ThreadPool_Equal > ThreadpoolHashSet;
8076325
 
8076325
 static ThreadpoolHashSet *g_pThreadpoolHashSet;
8076325
 
8076325
@@ -420,7 +424,7 @@
8076325
 
8076325
 	// Just ensure that the handle is unique in the process (via heap)
8076325
 	uno_ThreadPool h = new struct _uno_ThreadPool;
8076325
-	g_pThreadpoolHashSet->insert( h );
8076325
+	g_pThreadpoolHashSet->insert( ThreadpoolHashSet::value_type(h, ThreadPool::getInstance()) );
8076325
 	return h;
8076325
 }
8076325
 
8076325
--- cppu/source/threadpool/threadpool.hxx	2008-04-11 11:35:13.000000000 +0100
8076325
+++ cppu/source/threadpool/threadpool.hxx	2009-12-02 16:12:13.000000000 +0000
8076325
@@ -33,6 +33,8 @@
8076325
 
8076325
 #include <rtl/byteseq.hxx>
8076325
 
8076325
+#include <boost/shared_ptr.hpp>
8076325
+
8076325
 #include "jobqueue.hxx"
8076325
 
8076325
 
8076325
@@ -78,13 +80,16 @@
8076325
 	};
8076325
 	
8076325
 	typedef	::std::list	< struct ::cppu_threadpool::WaitingThread * > WaitingThreadList;
8076325
+
8076325
+	class DisposedCallerAdmin;
8076325
+	typedef boost::shared_ptr<DisposedCallerAdmin> DisposedCallerAdminHolder;
8076325
 	
8076325
 	class DisposedCallerAdmin
8076325
 	{
8076325
 	public:
8076325
 		~DisposedCallerAdmin();
8076325
 		
8076325
-		static DisposedCallerAdmin *getInstance();
8076325
+		static DisposedCallerAdminHolder getInstance();
8076325
 
8076325
 		void dispose( sal_Int64 nDisposeId );
8076325
 		void stopDisposing( sal_Int64 nDisposeId );
8076325
@@ -95,11 +100,15 @@
8076325
 		DisposedCallerList m_lst;
8076325
 	};
8076325
 
8076325
+	class ThreadPool;
8076325
+	typedef boost::shared_ptr<ThreadPool> ThreadPoolHolder;
8076325
+
8076325
 	class ThreadPool
8076325
 	{
8076325
 	public:
8076325
+		ThreadPool();
8076325
 		~ThreadPool();
8076325
-		static ThreadPool *getInstance();
8076325
+		static ThreadPoolHolder getInstance();
8076325
 		
8076325
 		void dispose( sal_Int64 nDisposeId );
8076325
 		void stopDisposing( sal_Int64 nDisposeId );
8076325
@@ -127,6 +136,8 @@
8076325
 		
8076325
 		::osl::Mutex m_mutexWaitingThreadList;
8076325
 		WaitingThreadList m_lstThreads;
8076325
+
8076325
+		DisposedCallerAdminHolder m_DisposedCallerAdmin;
8076325
 	};
8076325
 
8076325
 } // end namespace cppu_threadpool
8076325
--- cppu/source/uno/lbenv.cxx	2009-02-12 10:18:09.000000000 +0000
8076325
+++ cppu/source/uno/lbenv.cxx	2009-12-03 16:14:26.000000000 +0000
8076325
@@ -142,6 +142,7 @@
8076325
     ::osl::Mutex mutex;
8076325
     OUString2EnvironmentMap aName2EnvMap;
8076325
 
8076325
+    EnvironmentsData() : isDisposing(false) {}
8076325
     ~EnvironmentsData();
8076325
 
8076325
     inline void getEnvironment(
8076325
@@ -150,6 +151,8 @@
8076325
     inline void getRegisteredEnvironments(
8076325
         uno_Environment *** pppEnvs, sal_Int32 * pnLen,
8076325
         uno_memAlloc memAlloc, const OUString & rEnvDcp );
8076325
+
8076325
+    bool isDisposing;
8076325
 };
8076325
 
8076325
 namespace
8076325
@@ -598,9 +601,14 @@
8076325
         *ppHardEnv = 0;
8076325
     }
8076325
 
8076325
+    EnvironmentsData & rData = theEnvironmentsData::get();
8076325
+
8076325
+    if (rData.isDisposing)
8076325
+        return;
8076325
+
8076325
     uno_DefaultEnvironment * that = (uno_DefaultEnvironment *)pEnv;
8076325
     {
8076325
-    ::osl::MutexGuard guard( theEnvironmentsData::get().mutex );
8076325
+    ::osl::MutexGuard guard( rData.mutex );
8076325
     if (1 == ::osl_incrementInterlockedCount( &that->nRef )) // is dead
8076325
     {
8076325
         that->nRef = 0;
8076325
@@ -917,6 +925,7 @@
8076325
 EnvironmentsData::~EnvironmentsData()
8076325
 {
8076325
     ::osl::MutexGuard guard( mutex );
8076325
+    isDisposing = true;
8076325
 
8076325
     for ( OUString2EnvironmentMap::const_iterator iPos( aName2EnvMap.begin() );
8076325
           iPos != aName2EnvMap.end(); ++iPos )
8076325
--- cppu/util/target.pmk	2008-04-11 12:07:15.000000000 +0100
8076325
+++ cppu/util/target.pmk	2009-12-02 15:50:08.000000000 +0000
8076325
@@ -55,12 +55,3 @@
8076325
 .ENDIF
8076325
 
8076325
 .ENDIF
8076325
-
8076325
-# other stuff
8076325
-
8076325
-.IF "$(cppu_no_leak)" == ""
8076325
-.IF "$(bndchk)" == ""
8076325
-CFLAGS += -DCPPU_LEAK_STATIC_DATA
8076325
-.ENDIF
8076325
-.ENDIF
8076325
-
8076325
--- package/inc/ZipPackageFolder.hxx	2010-06-22 11:49:17.000000000 +0100
8076325
+++ package/inc/ZipPackageFolder.hxx	2010-06-22 12:50:26.000000000 +0100
8076325
@@ -53,8 +53,6 @@
8076325
 	::com::sun::star::container::XEnumerationAccess
8076325
 >
8076325
 {
8076325
-	static com::sun::star::uno::Sequence < sal_Int8 > aImplementationId;
8076325
-
8076325
 protected:
8076325
 	ContentHash maContents;
8076325
 	const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory;
8076325
@@ -82,10 +80,7 @@
8076325
 		throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
8076325
 
8076325
 	static void copyZipEntry( ZipEntry &rDest, const ZipEntry &rSource);
8076325
-	static ::com::sun::star::uno::Sequence < sal_Int8 > static_getImplementationId()
8076325
-	{
8076325
-		return aImplementationId;
8076325
-	}
8076325
+	static const ::com::sun::star::uno::Sequence < sal_Int8 >& static_getImplementationId();
8076325
 
8076325
 	void setPackageFormat_Impl( sal_Int32 nFormat ) { m_nFormat = nFormat; }
8076325
 	void setRemoveOnInsertMode_Impl( sal_Bool bRemove ) { this->mbAllowRemoveOnInsert = bRemove; }
8076325
--- package/source/xstor/owriteablestream.cxx	2010-06-22 11:49:15.000000000 +0100
8076325
+++ package/source/xstor/owriteablestream.cxx	2010-06-22 12:13:20.000000000 +0100
8076325
@@ -53,6 +53,7 @@
8076325
 
8076325
 #include <rtl/digest.h>
8076325
 #include <rtl/logfile.hxx>
8076325
+#include <rtl/instance.hxx>
8076325
 
8076325
 // since the copying uses 32000 blocks usually, it makes sense to have a smaller size
8076325
 #define MAX_STORCACHE_SIZE 30000
8076325
@@ -2169,25 +2170,14 @@
8076325
 	return m_pData->m_pTypeCollection->getTypes() ;
8076325
 }
8076325
 
8076325
+namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; }
8076325
+
8076325
 //-----------------------------------------------
8076325
 uno::Sequence< sal_Int8 > SAL_CALL OWriteStream::getImplementationId()
8076325
 		throw( uno::RuntimeException )
8076325
 {
8076325
-	static ::cppu::OImplementationId* pID = NULL ;
8076325
-
8076325
-	if ( pID == NULL )
8076325
-	{
8076325
-		::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ) ;
8076325
-
8076325
-		if ( pID == NULL )
8076325
-		{
8076325
-			static ::cppu::OImplementationId aID( sal_False ) ;
8076325
-			pID = &aID ;
8076325
-		}
8076325
-	}
8076325
-
8076325
-	return pID->getImplementationId() ;
8076325
-
8076325
+    ::cppu::OImplementationId &rId = lcl_ImplId::get();
8076325
+    return rId.getImplementationId();
8076325
 }
8076325
 
8076325
 //-----------------------------------------------
8076325
--- package/source/xstor/xstorage.cxx	2010-06-22 11:49:15.000000000 +0100
8076325
+++ package/source/xstor/xstorage.cxx	2010-06-22 12:11:45.000000000 +0100
8076325
@@ -48,6 +48,7 @@
8076325
 #include <cppuhelper/typeprovider.hxx>
8076325
 #include <cppuhelper/exc_hlp.hxx>
8076325
 #include <rtl/logfile.hxx>
8076325
+#include <rtl/instance.hxx>
8076325
 
8076325
 #include <comphelper/processfactory.hxx>
8076325
 #include <comphelper/componentcontext.hxx>
8076325
@@ -2367,25 +2368,14 @@
8076325
 	return m_pData->m_pTypeCollection->getTypes() ;
8076325
 }
8076325
 
8076325
+namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; }
8076325
+
8076325
 //-----------------------------------------------
8076325
 uno::Sequence< sal_Int8 > SAL_CALL OStorage::getImplementationId()
8076325
 		throw( uno::RuntimeException )
8076325
 {
8076325
-	static ::cppu::OImplementationId* pID = NULL ;
8076325
-
8076325
-	if ( pID == NULL )
8076325
-	{
8076325
-		::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ) ;
8076325
-
8076325
-		if ( pID == NULL )
8076325
-		{
8076325
-			static ::cppu::OImplementationId aID( sal_False ) ;
8076325
-			pID = &aID ;
8076325
-		}
8076325
-	}
8076325
-
8076325
-	return pID->getImplementationId() ;
8076325
-
8076325
+    ::cppu::OImplementationId &rID = lcl_ImplId::get();
8076325
+    return rID.getImplementationId();
8076325
 }
8076325
 
8076325
 //____________________________________________________________________________________________________
8076325
--- package/source/zippackage/ZipPackage.cxx	2010-06-22 11:49:16.000000000 +0100
8076325
+++ package/source/zippackage/ZipPackage.cxx	2010-06-22 12:12:00.000000000 +0100
8076325
@@ -68,6 +68,7 @@
8076325
 #include <rtl/uri.hxx>
8076325
 #include <rtl/random.h>
8076325
 #include <rtl/logfile.hxx>
8076325
+#include <rtl/instance.hxx>
8076325
 #include <osl/time.h>
8076325
 #include <osl/file.hxx>
8076325
 #include "com/sun/star/io/XAsyncOutputMonitor.hpp"
8076325
@@ -1585,21 +1586,14 @@
8076325
 										   static_getSupportedServiceNames());
8076325
 }
8076325
 
8076325
+namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; }
8076325
+
8076325
 // XUnoTunnel
8076325
 Sequence< sal_Int8 > ZipPackage::getUnoTunnelImplementationId( void ) 
8076325
 	throw (RuntimeException)
8076325
 {
8076325
-	static ::cppu::OImplementationId * pId = 0;
8076325
-	if (! pId)
8076325
-	{
8076325
-		::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
8076325
-		if (! pId)
8076325
-		{
8076325
-			static ::cppu::OImplementationId aId;
8076325
-			pId = &aI;;
8076325
-		}
8076325
-	}
8076325
-	return pId->getImplementationId();
8076325
+    ::cppu::OImplementationId &rId = lcl_ImplId::get();
8076325
+    return rId.getImplementationId();
8076325
 }
8076325
 
8076325
 sal_Int64 SAL_CALL ZipPackage::getSomething( const Sequence< sal_Int8 >& aIdentifier ) 
8076325
--- package/source/zippackage/ZipPackageFolder.cxx	2010-06-22 11:49:16.000000000 +0100
8076325
+++ package/source/zippackage/ZipPackageFolder.cxx	2010-06-22 12:50:00.000000000 +0100
8076325
@@ -43,6 +43,7 @@
8076325
 #include <com/sun/star/io/XSeekable.hpp>
8076325
 #include <EncryptedDataHeader.hxx>
8076325
 #include <rtl/random.h>
8076325
+#include <rtl/instance.hxx>
8076325
 #include <memory>
8076325
 
8076325
 using namespace com::sun::star::packages::zip::ZipConstants;
8076325
@@ -59,7 +60,7 @@
8076325
 using namespace ::com::sun::star;
8076325
 using vos::ORef;
8076325
 
8076325
-Sequence < sal_Int8 > ZipPackageFolder::aImplementationId = Sequence < sal_Int8 > ();
8076325
+namespace { struct lcl_CachedImplId : public rtl::Static< Sequence < sal_Int8 >, lcl_CachedImplId > {}; }
8076325
 
8076325
 ZipPackageFolder::ZipPackageFolder ( const Reference< XMultiServiceFactory >& xFactory,
8076325
 									 sal_Int32 nFormat,
8076325
@@ -80,10 +81,9 @@
8076325
 	aEntry.nCompressedSize	= 0;
8076325
 	aEntry.nSize		= 0;
8076325
 	aEntry.nOffset		= -1;
8076325
-	if ( !aImplementationId.getLength() )
8076325
-        {
8076325
-		aImplementationId = getImplementationId();
8076325
-        }
8076325
+	Sequence < sal_Int8 > &rCachedImplId = lcl_CachedImplId::get();
8076325
+	if ( !rCachedImplId.getLength() )
8076325
+	    rCachedImplId = getImplementationId();
8076325
 }
8076325
 
8076325
 
8076325
@@ -187,6 +187,11 @@
8076325
     rDest.nExtraLen			= rSource.nExtraLen;
8076325
 }
8076325
 
8076325
+const ::com::sun::star::uno::Sequence < sal_Int8 >& ZipPackageFolder::static_getImplementationId()
8076325
+{
8076325
+    return lcl_CachedImplId::get();
8076325
+}
8076325
+
8076325
 	// XNameContainer
8076325
 void SAL_CALL ZipPackageFolder::insertByName( const OUString& aName, const Any& aElement ) 
8076325
 		throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
8076325
--- package/source/zippackage/ZipPackageStream.cxx	2010-06-22 11:49:16.000000000 +0100
8076325
+++ package/source/zippackage/ZipPackageStream.cxx	2010-06-22 12:53:32.000000000 +0100
8076325
@@ -45,6 +45,8 @@
8076325
 #include <comphelper/seekableinput.hxx>
8076325
 #include <comphelper/storagehelper.hxx>
8076325
 
8076325
+#include <rtl/instance.hxx>
8076325
+
8076325
 #include <PackageConstants.hxx>
8076325
 
8076325
 using namespace com::sun::star::packages::zip::ZipConstants;
8076325
@@ -55,8 +57,12 @@
8076325
 using namespace cppu;
8076325
 using namespace rtl;
8076325
 
8076325
-Sequence < sal_Int8 > ZipPackageStream::aImplementationId = Sequence < sal_Int8 > ();
8076325
+namespace { struct lcl_CachedImplId : public rtl::Static< Sequence < sal_Int8 >, lcl_CachedImplId > {}; }
8076325
 
8076325
+const ::com::sun::star::uno::Sequence < sal_Int8 >& ZipPackageStream::static_getImplementationId()
8076325
+{
8076325
+    return lcl_CachedImplId::get();
8076325
+}
8076325
 
8076325
 ZipPackageStream::ZipPackageStream ( ZipPackage & rNewPackage,
8076325
 									const Reference< XMultiServiceFactory >& xFactory,
8076325
@@ -91,10 +97,9 @@
8076325
 	aEntry.nPathLen		= -1;
8076325
 	aEntry.nExtraLen	= -1;
8076325
 
8076325
-	if ( !aImplementationId.getLength() )
8076325
-        {
8076325
-            aImplementationId = getImplementationId();
8076325
-        }
8076325
+	Sequence < sal_Int8 > &rCachedImplId = lcl_CachedImplId::get();
8076325
+	if ( !rCachedImplId.getLength() )
8076325
+	    rCachedImplId = getImplementationId();
8076325
 }
8076325
 
8076325
 ZipPackageStream::~ZipPackageStream( void )
8076325
--- package/source/zippackage/ZipPackageStream.hxx	2010-06-22 11:49:16.000000000 +0100
8076325
+++ package/source/zippackage/ZipPackageStream.hxx	2010-06-22 12:51:18.000000000 +0100
8076325
@@ -55,7 +55,6 @@
8076325
 	::com::sun::star::packages::XDataSinkEncrSupport
8076325
 >
8076325
 {
8076325
-	static com::sun::star::uno::Sequence < sal_Int8 > aImplementationId;
8076325
 protected:
8076325
 	com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xStream;
8076325
 	const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory;
8076325
@@ -146,10 +145,7 @@
8076325
     ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getRawData()
8076325
 		throw(::com::sun::star::uno::RuntimeException);
8076325
 	
8076325
-	static ::com::sun::star::uno::Sequence < sal_Int8 >& static_getImplementationId()
8076325
-	{
8076325
-		return aImplementationId;
8076325
-	}
8076325
+	static const ::com::sun::star::uno::Sequence < sal_Int8 >& static_getImplementationId();
8076325
 
8076325
 	// XActiveDataSink
8076325
     virtual void SAL_CALL setInputStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& aStream )