Kaydet (Commit) 3f250092 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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
üst 90f3840e
......@@ -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 }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment