[Libreoffice-commits] .: stoc/source

Stephan Bergmann sbergmann at kemper.freedesktop.org
Fri May 25 07:29:48 PDT 2012


 stoc/source/invocation_adapterfactory/iafactory.cxx |   16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

New commits:
commit 3f250092747263fb14a3f13c4509ebd02ec2fb2a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri May 25 16:22:11 2012 +0200

    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

diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx
index 337bdb1..361e798 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 }


More information about the Libreoffice-commits mailing list