From 3f250092747263fb14a3f13c4509ebd02ec2fb2a Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 25 May 2012 16:22:11 +0200 Subject: Use simple createOneInstanceComponentFactory ...instead of static WeakReference and getGlobalMutex. The latter allowed for deadlock, when one thread is in __getTypeEntries (cppuhelper/source/implbase_ex.cxx), having locked getImplHelperInitMutex(), and from there calls some cppu_detail_getUnoType (from a cppumaker-generated header) that tries to lock getGloblaMutex, while another thread is in this FactoryImpl_create, having locked getGlobalMutex, and from there calls into __getTypeEntries. Change-Id: Iac68d28c1a5971049447cc79384b6e186f2a6d82 --- stoc/source/invocation_adapterfactory/iafactory.cxx | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'stoc') diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx index 337bdb1023c9..361e798cf48f 100644 --- a/stoc/source/invocation_adapterfactory/iafactory.cxx +++ b/stoc/source/invocation_adapterfactory/iafactory.cxx @@ -943,19 +943,7 @@ static Reference< XInterface > SAL_CALL FactoryImpl_create( const Reference< XComponentContext > & xContext ) throw (Exception) { - Reference< XInterface > rRet; - { - MutexGuard guard( Mutex::getGlobalMutex() ); - static WeakReference < XInterface > rwInstance; - rRet = rwInstance; - - if( ! rRet.is() ) - { - rRet = (::cppu::OWeakObject *)new FactoryImpl( xContext ); - rwInstance = rRet; - } - } - return rRet; + return (::cppu::OWeakObject *)new FactoryImpl( xContext ); } } @@ -971,7 +959,7 @@ static struct ::cppu::ImplementationEntry g_entries[] = ::stoc_invadp::FactoryImpl_create, ::stoc_invadp::invadp_getImplementationName, ::stoc_invadp::invadp_getSupportedServiceNames, - ::cppu::createSingleComponentFactory, + ::cppu::createOneInstanceComponentFactory, &::stoc_invadp::g_moduleCount.modCnt , 0 }, { 0, 0, 0, 0, 0, 0 } -- cgit