diff options
Diffstat (limited to 'stoc/source')
-rw-r--r-- | stoc/source/invocation_adapterfactory/iafactory.cxx | 8 | ||||
-rw-r--r-- | stoc/source/invocation_adapterfactory/invocadapt.component | 2 | ||||
-rw-r--r-- | stoc/source/proxy_factory/proxyfac.component | 2 | ||||
-rw-r--r-- | stoc/source/proxy_factory/proxyfac.cxx | 18 |
4 files changed, 6 insertions, 24 deletions
diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx index 65322c3a6234..126af1f82851 100644 --- a/stoc/source/invocation_adapterfactory/iafactory.cxx +++ b/stoc/source/invocation_adapterfactory/iafactory.cxx @@ -23,7 +23,6 @@ #include <osl/mutex.hxx> #include <o3tl/sorted_vector.hxx> #include <sal/log.hxx> -#include <rtl/ref.hxx> #include <uno/dispatcher.h> #include <uno/data.h> @@ -33,7 +32,7 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> - +#include <cppuhelper/weak.hxx> #include <com/sun/star/script/XTypeConverter.hpp> #include <com/sun/star/script/XInvocationAdapterFactory.hpp> #include <com/sun/star/script/XInvocationAdapterFactory2.hpp> @@ -876,10 +875,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* stoc_invocation_adapter_get_implementation( css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) { - static rtl::Reference<stoc_invadp::FactoryImpl> g_Instance(new stoc_invadp::FactoryImpl(context)); - - g_Instance->acquire(); - return static_cast<cppu::OWeakObject*>(g_Instance.get()); + return cppu::acquire(static_cast<cppu::OWeakObject*>(new stoc_invadp::FactoryImpl(context))); } diff --git a/stoc/source/invocation_adapterfactory/invocadapt.component b/stoc/source/invocation_adapterfactory/invocadapt.component index 9dbf20e48bad..ec1723e22a9b 100644 --- a/stoc/source/invocation_adapterfactory/invocadapt.component +++ b/stoc/source/invocation_adapterfactory/invocadapt.component @@ -20,7 +20,7 @@ <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.stoc.InvocationAdapterFactory" - constructor="stoc_invocation_adapter_get_implementation"> + constructor="stoc_invocation_adapter_get_implementation" single-instance="true"> <service name="com.sun.star.script.InvocationAdapterFactory"/> </implementation> </component> diff --git a/stoc/source/proxy_factory/proxyfac.component b/stoc/source/proxy_factory/proxyfac.component index eee87014ca98..b069f88dff81 100644 --- a/stoc/source/proxy_factory/proxyfac.component +++ b/stoc/source/proxy_factory/proxyfac.component @@ -20,7 +20,7 @@ <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.reflection.ProxyFactory" - constructor="stoc_FactoryImpl_get_implementation"> + constructor="stoc_FactoryImpl_get_implementation" single-instance="true"> <service name="com.sun.star.reflection.ProxyFactory"/> </implementation> </component> diff --git a/stoc/source/proxy_factory/proxyfac.cxx b/stoc/source/proxy_factory/proxyfac.cxx index cecb6d917b39..b1c5597d0311 100644 --- a/stoc/source/proxy_factory/proxyfac.cxx +++ b/stoc/source/proxy_factory/proxyfac.cxx @@ -20,7 +20,6 @@ #include <osl/diagnose.h> #include <osl/interlck.h> -#include <osl/mutex.hxx> #include <rtl/ref.hxx> #include <uno/dispatcher.hxx> #include <uno/data.h> @@ -31,6 +30,7 @@ #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> +#include <cppuhelper/weak.hxx> #include <cppuhelper/weakagg.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/reflection/XProxyFactory.hpp> @@ -401,21 +401,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* stoc_FactoryImpl_get_implementation( css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - Reference< XInterface > xRet; - static osl::Mutex s_mutex; - // note: don't use ::osl::Mutex::getGlobalMutex() here, it deadlocks - // with getImplHelperInitMutex() - ::osl::MutexGuard guard(s_mutex); - static WeakReference < XInterface > rwInstance; - xRet = rwInstance; - - if (! xRet.is()) - { - xRet = static_cast< ::cppu::OWeakObject * >(new FactoryImpl); - rwInstance = xRet; - } - xRet->acquire(); - return xRet.get(); + return cppu::acquire(static_cast< ::cppu::OWeakObject * >(new FactoryImpl)); } |