rpms/openoffice.org/F-13 openoffice.org-3.3.0.ooo107490.cppu.lifecycle.patch, NONE, 1.1 openoffice.org.spec, 1.2200, 1.2201

Caolan McNamara caolanm at fedoraproject.org
Fri Jun 18 15:08:59 UTC 2010


Author: caolanm

Update of /cvs/pkgs/rpms/openoffice.org/F-13
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv12955

Modified Files:
	openoffice.org.spec 
Added Files:
	openoffice.org-3.3.0.ooo107490.cppu.lifecycle.patch 
Log Message:
Related: rhbz#604850 add in the lifecycle thingy and see if that track this down further

openoffice.org-3.3.0.ooo107490.cppu.lifecycle.patch:
 source/threadpool/jobqueue.cxx   |    3 +
 source/threadpool/jobqueue.hxx   |    6 +++
 source/threadpool/thread.cxx     |   29 +++++++-----------
 source/threadpool/thread.hxx     |    2 -
 source/threadpool/threadpool.cxx |   60 ++++++++++++++++++++-------------------
 source/threadpool/threadpool.hxx |   15 ++++++++-
 source/uno/lbenv.cxx             |   11 ++++++-
 util/target.pmk                  |    9 -----
 8 files changed, 76 insertions(+), 59 deletions(-)

--- NEW FILE openoffice.org-3.3.0.ooo107490.cppu.lifecycle.patch ---
diff -ru OOO320_m6/cppu/source/threadpool/jobqueue.cxx OOO320_m6/cppu/source/threadpool/jobqueue.cxx
--- OOO320_m6/cppu/source/threadpool/jobqueue.cxx	2008-04-11 11:33:02.000000000 +0100
+++ OOO320_m6/cppu/source/threadpool/jobqueue.cxx	2009-12-02 16:14:26.000000000 +0000
@@ -45,6 +45,7 @@
 		m_cndWait( osl_createCondition() )
 	{
 		osl_resetCondition( m_cndWait );		
+		m_DisposedCallerAdmin = DisposedCallerAdmin::getInstance();
 	}
 	
 	JobQueue::~JobQueue()
@@ -71,7 +72,7 @@
 		{
 			// synchronize with the dispose calls
 			MutexGuard guard( m_mutex );
-			if( DisposedCallerAdmin::getInstance()->isDisposed( nDisposeId ) )
+			if( m_DisposedCallerAdmin->isDisposed( nDisposeId ) )
 			{
 				return 0;
 			}
diff -ru OOO320_m6/cppu/source/threadpool/jobqueue.hxx OOO320_m6/cppu/source/threadpool/jobqueue.hxx
--- OOO320_m6/cppu/source/threadpool/jobqueue.hxx	2008-04-11 11:33:18.000000000 +0100
+++ OOO320_m6/cppu/source/threadpool/jobqueue.hxx	2009-12-02 16:15:49.000000000 +0000
@@ -37,6 +37,8 @@
 #include <osl/conditn.h>
 #include <osl/mutex.hxx>
 
+#include <boost/shared_ptr.hpp>
+
 namespace cppu_threadpool
 {
     extern "C" typedef void (SAL_CALL RequestFun)(void *);
@@ -51,6 +53,9 @@
 
 	typedef	::std::list	< sal_Int64 > CallStackList;
 
+	class DisposedCallerAdmin;
+	typedef boost::shared_ptr<DisposedCallerAdmin> DisposedCallerAdminHolder;
+
 	class JobQueue
 	{
 	public:
@@ -76,6 +81,7 @@
 		sal_Int32 m_nToDo;
 		sal_Bool m_bSuspended;
 		oslCondition m_cndWait;
+		DisposedCallerAdminHolder m_DisposedCallerAdmin;
 	};
 }
 
diff -ru OOO320_m6/cppu/source/threadpool/thread.cxx OOO320_m6/cppu/source/threadpool/thread.cxx
--- OOO320_m6/cppu/source/threadpool/thread.cxx	2008-04-11 11:34:00.000000000 +0100
+++ OOO320_m6/cppu/source/threadpool/thread.cxx	2009-12-03 16:15:02.000000000 +0000
@@ -34,6 +34,8 @@
 #include <osl/diagnose.h>
 #include <uno/threadpool.h>
 
+#include <rtl/instance.hxx>
+
 #include "thread.hxx"
 #include "jobqueue.hxx"
 #include "threadpool.hxx"
@@ -101,20 +103,11 @@
 		} while( pCurrent );
 	}
 
-	ThreadAdmin* ThreadAdmin::getInstance()
-	{
-		static ThreadAdmin *pThreadAdmin = 0;
-		if( ! pThreadAdmin )
-		{
-			MutexGuard guard( Mutex::getGlobalMutex() );
-			if( ! pThreadAdmin )
-			{
-				static ThreadAdmin admin;
-				pThreadAdmin = &admin;
-			}
-		}
-		return pThreadAdmin;
+	struct theThreadAdmin : public rtl::Static< ThreadAdmin, theThreadAdmin > {};
 
+	ThreadAdmin& ThreadAdmin::getInstance()
+	{
+		return theThreadAdmin::get();
 	}
 
 // ----------------------------------------------------------------------------------
@@ -127,7 +120,7 @@
 		, m_bAsynchron( bAsynchron )
 		, m_bDeleteSelf( sal_True )
 	{
-		ThreadAdmin::getInstance()->add( this );
+		ThreadAdmin::getInstance().add( this );
 	}
 
 
@@ -169,7 +162,7 @@
 
 	void ORequestThread::onTerminated()
 	{
-		ThreadAdmin::getInstance()->remove( this );
+		ThreadAdmin::getInstance().remove( this );
 		if( m_bDeleteSelf )
 		{
 			delete this;
@@ -178,6 +171,8 @@
 
 	void ORequestThread::run()
 	{
+		ThreadPoolHolder theThreadPool = cppu_threadpool::ThreadPool::getInstance();
+
 		while ( m_pQueue )
 		{
 			if( ! m_bAsynchron )
@@ -200,7 +195,7 @@
 
 				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).
 				}
@@ -214,7 +209,7 @@
 				uno_releaseIdFromCurrentThread();
 			}
 
-			cppu_threadpool::ThreadPool::getInstance()->waitInPool( this );
+			theThreadPool->waitInPool( this );
 		}
 	}
 }
diff -ru OOO320_m6/cppu/source/threadpool/thread.hxx OOO320_m6/cppu/source/threadpool/thread.hxx
--- OOO320_m6/cppu/source/threadpool/thread.hxx	2008-04-11 11:34:18.000000000 +0100
+++ OOO320_m6/cppu/source/threadpool/thread.hxx	2009-12-02 15:58:34.000000000 +0000
@@ -74,7 +74,7 @@
 	{
 	public:
 		~ThreadAdmin ();
-		static ThreadAdmin *getInstance();
+		static ThreadAdmin &getInstance();
 		void add( ORequestThread * );
 		void remove( ORequestThread * );
 		void join();
diff -ru OOO320_m6/cppu/source/threadpool/threadpool.cxx OOO320_m6/cppu/source/threadpool/threadpool.cxx
--- OOO320_m6/cppu/source/threadpool/threadpool.cxx	2008-04-11 11:34:54.000000000 +0100
+++ OOO320_m6/cppu/source/threadpool/threadpool.cxx	2009-12-03 16:14:56.000000000 +0000
@@ -36,6 +36,7 @@
 #include <osl/diagnose.h>
 #include <osl/mutex.hxx>
 #include <osl/thread.h>
+#include <rtl/instance.hxx>
 
 #include <uno/threadpool.h>
 
@@ -47,19 +48,17 @@
 
 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()
@@ -110,6 +109,21 @@
 
 
 	//-------------------------------------------------------------------------------
+
+	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
@@ -119,19 +133,9 @@
 		}
 #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();
 	}
 
 
@@ -139,7 +143,7 @@
 	{
 		if( nDisposeId )
 		{
-			DisposedCallerAdmin::getInstance()->dispose( nDisposeId );
+			m_DisposedCallerAdmin->dispose( nDisposeId );
 
 			MutexGuard guard( m_mutex );
 			for( ThreadIdHashMap::iterator ii = m_mapQueue.begin() ;
@@ -168,13 +172,13 @@
 					osl_setCondition( (*ii)->condition );
 				}
 			}
-			ThreadAdmin::getInstance()->join();
+			ThreadAdmin::getInstance().join();
 		}
 	}
 
 	void ThreadPool::stopDisposing( sal_Int64 nDisposeId )
 	{
-		DisposedCallerAdmin::getInstance()->stopDisposing( nDisposeId );
+		m_DisposedCallerAdmin->stopDisposing( nDisposeId );
 	}
 
 	/******************
@@ -403,7 +407,7 @@
 
 
 
-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;
 
@@ -423,7 +427,7 @@
 
 	// 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 -ru OOO320_m6/cppu/source/threadpool/threadpool.hxx OOO320_m6/cppu/source/threadpool/threadpool.hxx
--- OOO320_m6/cppu/source/threadpool/threadpool.hxx	2008-04-11 11:35:13.000000000 +0100
+++ OOO320_m6/cppu/source/threadpool/threadpool.hxx	2009-12-02 16:12:13.000000000 +0000
@@ -33,6 +33,8 @@
 
 #include <rtl/byteseq.hxx>
 
+#include <boost/shared_ptr.hpp>
+
 #include "jobqueue.hxx"
 
 
@@ -78,13 +80,16 @@
 	};
 	
 	typedef	::std::list	< struct ::cppu_threadpool::WaitingThread * > WaitingThreadList;
+
+	class DisposedCallerAdmin;
+	typedef boost::shared_ptr<DisposedCallerAdmin> DisposedCallerAdminHolder;
 	
 	class DisposedCallerAdmin
 	{
 	public:
 		~DisposedCallerAdmin();
 		
-		static DisposedCallerAdmin *getInstance();
+		static DisposedCallerAdminHolder getInstance();
 
 		void dispose( sal_Int64 nDisposeId );
 		void stopDisposing( sal_Int64 nDisposeId );
@@ -95,11 +100,15 @@
 		DisposedCallerList m_lst;
 	};
 
+	class ThreadPool;
+	typedef boost::shared_ptr<ThreadPool> ThreadPoolHolder;
+
 	class ThreadPool
 	{
 	public:
+		ThreadPool();
 		~ThreadPool();
-		static ThreadPool *getInstance();
+		static ThreadPoolHolder getInstance();
 		
 		void dispose( sal_Int64 nDisposeId );
 		void stopDisposing( sal_Int64 nDisposeId );
@@ -127,6 +136,8 @@
 		
 		::osl::Mutex m_mutexWaitingThreadList;
 		WaitingThreadList m_lstThreads;
+
+		DisposedCallerAdminHolder m_DisposedCallerAdmin;
 	};
 
 } // end namespace cppu_threadpool
diff -ru OOO320_m6/cppu/source/uno/lbenv.cxx OOO320_m6/cppu/source/uno/lbenv.cxx
--- OOO320_m6/cppu/source/uno/lbenv.cxx	2009-02-12 10:18:09.000000000 +0000
+++ OOO320_m6/cppu/source/uno/lbenv.cxx	2009-12-03 16:14:26.000000000 +0000
@@ -142,6 +142,7 @@
     ::osl::Mutex mutex;
     OUString2EnvironmentMap aName2EnvMap;
 
+    EnvironmentsData() : isDisposing(false) {}
     ~EnvironmentsData();
 
     inline void getEnvironment(
@@ -150,6 +151,8 @@
     inline void getRegisteredEnvironments(
         uno_Environment *** pppEnvs, sal_Int32 * pnLen,
         uno_memAlloc memAlloc, const OUString & rEnvDcp );
+
+    bool isDisposing;
 };
 
 namespace
@@ -598,9 +601,14 @@
         *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;
@@ -917,6 +925,7 @@
 EnvironmentsData::~EnvironmentsData()
 {
     ::osl::MutexGuard guard( mutex );
+    isDisposing = true;
 
     for ( OUString2EnvironmentMap::const_iterator iPos( aName2EnvMap.begin() );
           iPos != aName2EnvMap.end(); ++iPos )
diff -ru OOO320_m6/cppu/util/target.pmk OOO320_m6/cppu/util/target.pmk
--- OOO320_m6/cppu/util/target.pmk	2008-04-11 12:07:15.000000000 +0100
+++ OOO320_m6/cppu/util/target.pmk	2009-12-02 15:50:08.000000000 +0000
@@ -55,12 +55,3 @@
 .ENDIF
 
 .ENDIF
-
-# other stuff
-
-.IF "$(cppu_no_leak)" == ""
-.IF "$(bndchk)" == ""
-CFLAGS += -DCPPU_LEAK_STATIC_DATA
-.ENDIF
-.ENDIF
-


Index: openoffice.org.spec
===================================================================
RCS file: /cvs/pkgs/rpms/openoffice.org/F-13/openoffice.org.spec,v
retrieving revision 1.2200
retrieving revision 1.2201
diff -u -p -r1.2200 -r1.2201
--- openoffice.org.spec	18 Jun 2010 14:43:57 -0000	1.2200
+++ openoffice.org.spec	18 Jun 2010 15:08:58 -0000	1.2201
@@ -162,6 +162,7 @@ Patch91: workspace.ooo321gsl05.patch
 Patch92: openoffice.org-3.3.0.ooo112384.sw.export.doc.styledoesntexist.patch
 Patch93: workspace.gtkfpicker9.patch
 Patch94: openoffice.org-3.3.0.ooo112516.sw.avoid.divbyzero.patch
+Patch95: openoffice.org-3.3.0.ooo107490.cppu.lifecycle.patch
 
 %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
 %define instdir %{_libdir}
@@ -1754,6 +1755,7 @@ cp -p %{SOURCE5} external/unowinreg/unow
 %patch92 -p0 -b .ooo112384.sw.export.doc.styledoesntexist.patch
 %patch93 -p0 -b .workspace.gtkfpicker9.patch
 %patch94 -p0 -b .ooo112516.sw.avoid.divbyzero.patch
+%patch95 -p1 -b .ooo107490.cppu.lifecycle.patch
 
 %build
 echo build start time is `date`, diskspace: `df -h . | tail -n 1`
@@ -4239,12 +4241,13 @@ fi
 %endif
 
 %changelog
-* Fri Jun 18 2010 Caolán McNamara <caolanm at redhat.com> - 1:3.2.0-12.25-UNRELEASED
+* Fri Jun 18 2010 Caolán McNamara <caolanm at redhat.com> - 1:3.2.0-12.25
 - Resolves: rhbz#602631 dual head fixes add workspace.ooo321gsl05.patch
 - Resolves: rhbz#603298 crash in ImplFontCharMap::GetGlyphIndex
 - Resolves: rhbz#601890/ooo#112384 avoid crash on export to .doc
 - Resolves: rhbz#603043/ooo#112386 improve gtk fpicker stability
 - Resolves: rhbz#605594 openoffice.org-3.3.0.ooo112516.sw.avoid.divbyzero.patch
+- Resolves: rhbz#604850 openoffice.org-3.3.0.ooo107490.cppu.lifecycle.patch
 
 * Sat Jun 05 2010 Caolán McNamara <caolanm at redhat.com> - 1:3.2.0-12.24
 - Resolves: CVE-2010-0395 openoffice.org-3.2.1.pyuno.patch



More information about the scm-commits mailing list