From beeba4adcdd2f91d032e689da49b8c32eb6433ce Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien Date: Wed, 19 Apr 2006 12:49:08 +0000 Subject: [PATCH] INTEGRATION: CWS sb49 (1.7.38); FILE MERGED 2006/03/22 10:14:05 sb 1.7.38.1: #i63397# Keep objects alive long enough so that threads still running while atexit handlers are processed do not access dead objects. --- cppu/source/threadpool/thread.cxx | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/cppu/source/threadpool/thread.cxx b/cppu/source/threadpool/thread.cxx index 924a7126fa5e..caf6910d1cae 100644 --- a/cppu/source/threadpool/thread.cxx +++ b/cppu/source/threadpool/thread.cxx @@ -4,9 +4,9 @@ * * $RCSfile: thread.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: rt $ $Date: 2005-09-08 08:47:03 $ + * last change: $Author: hr $ $Date: 2006-04-19 13:49:08 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -120,10 +120,13 @@ namespace cppu_threadpool { } // ---------------------------------------------------------------------------------- - ORequestThread::ORequestThread( JobQueue *pQueue, - const ByteSequence &aThreadId, - sal_Bool bAsynchron ) + ORequestThread::ORequestThread( + rtl::Reference< ThreadPool > const & threadPool, + JobQueue *pQueue, + const ByteSequence &aThreadId, + sal_Bool bAsynchron ) : m_thread( 0 ) + , m_threadPool( threadPool ) , m_pQueue( pQueue ) , m_aThreadId( aThreadId ) , m_bAsynchron( bAsynchron ) @@ -193,11 +196,13 @@ namespace cppu_threadpool { // Note : Oneways should not get a disposable disposeid, // It does not make sense to dispose a call in this state. // That's way we put it an disposeid, that can't be used otherwise. - m_pQueue->enter( (sal_Int64 ) this , sal_True ); + m_pQueue->enter( + m_threadPool->m_disposedCallerAdmin, (sal_Int64 ) this, + sal_True ); if( m_pQueue->isEmpty() ) { - ThreadPool::getInstance()->revokeQueue( m_aThreadId , m_bAsynchron ); + m_threadPool->revokeQueue( m_aThreadId , m_bAsynchron ); // Note : revokeQueue might have failed because m_pQueue.isEmpty() // may be false (race). } @@ -211,7 +216,7 @@ namespace cppu_threadpool { uno_releaseIdFromCurrentThread(); } - cppu_threadpool::ThreadPool::getInstance()->waitInPool( this ); + m_threadPool->waitInPool( this ); } } }