diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-09-30 22:21:49 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-10-01 09:47:05 +0200 |
commit | 5204be412e0e0fc138b82f886b83d5b8e0e77dd2 (patch) | |
tree | 9dce258e2e0be50a03e6d81811a76beb08347c69 /ucb/source/core/ucb.cxx | |
parent | 8e126adb49f47e4b94841c1dcb4628a8c64d597b (diff) |
Use the new single-instance="true" attribute in ucb
It looks like 3d44c6a49b20415616dab7a2de2820da5efab309 "ucb/core: create
instances with uno constructors" mixed up
com.sun.star.comp.ucb.UcbPropertiesManager (which had originally been
implemented with the single-instance cppu::createOneInstanceFactory) and
com.sun.star.comp.ucb.SimpleFileAccess (which had originally been implemented
with the multi-instance cppu::createSingleFactory), using a static
g_Instance in the C++ constructor function of the former but adding a fake
<singleton> to the *.component <implementation> of the latter.
Change-Id: Ida7cb242a73fbe7689094e239ffe0c0291cf1d3c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103738
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'ucb/source/core/ucb.cxx')
-rw-r--r-- | ucb/source/core/ucb.cxx | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/ucb/source/core/ucb.cxx b/ucb/source/core/ucb.cxx index 304e37c37728..64f74ec26d00 100644 --- a/ucb/source/core/ucb.cxx +++ b/ucb/source/core/ucb.cxx @@ -39,9 +39,9 @@ #include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/uno/Any.hxx> +#include <cppuhelper/weak.hxx> #include <ucbhelper/cancelcommandexecution.hxx> #include <ucbhelper/macros.hxx> -#include <rtl/ref.hxx> #include "identify.hxx" #include "ucbcmds.hxx" @@ -55,9 +55,6 @@ using namespace ucb_impl; using namespace com::sun::star; using namespace ucbhelper; -static osl::Mutex g_InstanceGuard; -static rtl::Reference<UniversalContentBroker> g_Instance; - namespace { bool fillPlaceholders(OUString const & rInput, @@ -254,9 +251,6 @@ void SAL_CALL UniversalContentBroker::dispose() if ( m_xNotifier.is() ) m_xNotifier->removeChangesListener( this ); - - osl::MutexGuard aGuard(g_InstanceGuard); - g_Instance.clear(); } @@ -302,11 +296,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* ucb_UniversalContentBroker_get_implementation( css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) { - osl::MutexGuard aGuard(g_InstanceGuard); - if (!g_Instance) - g_Instance.set(new UniversalContentBroker(context)); - g_Instance->acquire(); - return static_cast<cppu::OWeakObject*>(g_Instance.get()); + return cppu::acquire(static_cast<cppu::OWeakObject*>(new UniversalContentBroker(context))); } |