diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-10-02 14:16:57 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-10-02 20:40:24 +0200 |
commit | d7d3c11357efb65bd9721e6fedae2486162d1a71 (patch) | |
tree | d215446e64077a2a2550f51311718d3210fee35d /ucb | |
parent | 8c1f608c1400d314061f96d6d63b3357da5b2786 (diff) |
Use the new single-instance="true" attribute in ucb
Change-Id: I7eb38f0da1d88fd0f7ca4a1054546617b10a3502
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103843
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/sorter/sortdynres.cxx | 5 | ||||
-rw-r--r-- | ucb/source/sorter/srtrs1.component | 2 | ||||
-rw-r--r-- | ucb/source/ucp/cmis/cmis_provider.cxx | 5 | ||||
-rw-r--r-- | ucb/source/ucp/cmis/ucpcmis1.component | 2 | ||||
-rw-r--r-- | ucb/source/ucp/ext/ucpext.component | 2 | ||||
-rw-r--r-- | ucb/source/ucp/ext/ucpext_provider.cxx | 5 | ||||
-rw-r--r-- | ucb/source/ucp/ftp/ftpcontentprovider.cxx | 5 | ||||
-rw-r--r-- | ucb/source/ucp/ftp/ucpftp1.component | 2 | ||||
-rw-r--r-- | ucb/source/ucp/gio/gio_provider.cxx | 16 | ||||
-rw-r--r-- | ucb/source/ucp/gio/ucpgio.component | 2 | ||||
-rw-r--r-- | ucb/source/ucp/hierarchy/hierarchydatasource.cxx | 6 | ||||
-rw-r--r-- | ucb/source/ucp/hierarchy/hierarchyprovider.cxx | 5 | ||||
-rw-r--r-- | ucb/source/ucp/hierarchy/ucphier1.component | 4 | ||||
-rw-r--r-- | ucb/source/ucp/package/pkgprovider.cxx | 4 | ||||
-rw-r--r-- | ucb/source/ucp/package/ucppkg1.component | 2 | ||||
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx | 6 | ||||
-rw-r--r-- | ucb/source/ucp/tdoc/ucptdoc1.component | 2 |
17 files changed, 30 insertions, 45 deletions
diff --git a/ucb/source/sorter/sortdynres.cxx b/ucb/source/sorter/sortdynres.cxx index cbacf231e233..401a3ef0afe7 100644 --- a/ucb/source/sorter/sortdynres.cxx +++ b/ucb/source/sorter/sortdynres.cxx @@ -20,6 +20,7 @@ #include "sortdynres.hxx" #include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/supportsservice.hxx> +#include <cppuhelper/weak.hxx> #include <com/sun/star/ucb/ContentResultSetCapability.hpp> #include <com/sun/star/ucb/ListActionType.hpp> #include <com/sun/star/ucb/ListenerAlreadySetException.hpp> @@ -436,9 +437,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* ucb_SortedDynamicResultSetFactory_get_implementation( css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) { - static rtl::Reference<SortedDynamicResultSetFactory> g_Instance(new SortedDynamicResultSetFactory(context)); - g_Instance->acquire(); - return static_cast<cppu::OWeakObject*>(g_Instance.get()); + return cppu::acquire(static_cast<cppu::OWeakObject*>(new SortedDynamicResultSetFactory(context))); } // SortedDynamicResultSetFactory methods. diff --git a/ucb/source/sorter/srtrs1.component b/ucb/source/sorter/srtrs1.component index d3d26136002f..a96277d0b002 100644 --- a/ucb/source/sorter/srtrs1.component +++ b/ucb/source/sorter/srtrs1.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.ucb.SortedDynamicResultSetFactory" - constructor="ucb_SortedDynamicResultSetFactory_get_implementation"> + constructor="ucb_SortedDynamicResultSetFactory_get_implementation" single-instance="true"> <service name="com.sun.star.ucb.SortedDynamicResultSetFactory"/> </implementation> </component> diff --git a/ucb/source/ucp/cmis/cmis_provider.cxx b/ucb/source/ucp/cmis/cmis_provider.cxx index 219d1f5f0d6f..b6f207b62cd3 100644 --- a/ucb/source/ucp/cmis/cmis_provider.cxx +++ b/ucb/source/ucp/cmis/cmis_provider.cxx @@ -9,6 +9,7 @@ #include <comphelper/processfactory.hxx> #include <cppuhelper/queryinterface.hxx> +#include <cppuhelper/weak.hxx> #include <ucbhelper/contenthelper.hxx> #include <ucbhelper/macros.hxx> #include <com/sun/star/ucb/ContentCreationException.hpp> @@ -136,9 +137,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* ucb_cmis_ContentProvider_get_implementation( css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) { - static rtl::Reference<cmis::ContentProvider> g_Instance(new cmis::ContentProvider(context)); - g_Instance->acquire(); - return static_cast<cppu::OWeakObject*>(g_Instance.get()); + return cppu::acquire(static_cast<cppu::OWeakObject*>(new cmis::ContentProvider(context))); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucb/source/ucp/cmis/ucpcmis1.component b/ucb/source/ucp/cmis/ucpcmis1.component index a1339fc20f16..101a892a0627 100644 --- a/ucb/source/ucp/cmis/ucpcmis1.component +++ b/ucb/source/ucp/cmis/ucpcmis1.component @@ -10,7 +10,7 @@ <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.CmisContentProvider" - constructor="ucb_cmis_ContentProvider_get_implementation"> + constructor="ucb_cmis_ContentProvider_get_implementation" single-instance="true"> <service name="com.sun.star.ucb.CmisContentProvider"/> </implementation> </component> diff --git a/ucb/source/ucp/ext/ucpext.component b/ucb/source/ucp/ext/ucpext.component index 0f1b96555baf..879837e5f0b3 100644 --- a/ucb/source/ucp/ext/ucpext.component +++ b/ucb/source/ucp/ext/ucpext.component @@ -20,7 +20,7 @@ <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="org.openoffice.comp.ucp.ext.ContentProvider" - constructor="ucb_ext_ContentProvider_get_implementation"> + constructor="ucb_ext_ContentProvider_get_implementation" single-instance="true"> <service name="com.sun.star.ucb.ExtensionContentProvider"/> </implementation> </component> diff --git a/ucb/source/ucp/ext/ucpext_provider.cxx b/ucb/source/ucp/ext/ucpext_provider.cxx index 717077bc8dbc..cd8141e8fe0a 100644 --- a/ucb/source/ucp/ext/ucpext_provider.cxx +++ b/ucb/source/ucp/ext/ucpext_provider.cxx @@ -21,6 +21,7 @@ #include "ucpext_content.hxx" #include <com/sun/star/ucb/IllegalIdentifierException.hpp> +#include <cppuhelper/weak.hxx> #include <ucbhelper/contentidentifier.hxx> #include <osl/mutex.hxx> #include <rtl/ustrbuf.hxx> @@ -164,9 +165,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* ucb_ext_ContentProvider_get_implementation( css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) { - static rtl::Reference<ucb::ucp::ext::ContentProvider> g_Instance(new ucb::ucp::ext::ContentProvider(context)); - g_Instance->acquire(); - return static_cast<cppu::OWeakObject*>(g_Instance.get()); + return cppu::acquire(static_cast<cppu::OWeakObject*>(new ucb::ucp::ext::ContentProvider(context))); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.cxx b/ucb/source/ucp/ftp/ftpcontentprovider.cxx index 72d848aa6b2c..72e427e22934 100644 --- a/ucb/source/ucp/ftp/ftpcontentprovider.cxx +++ b/ucb/source/ucp/ftp/ftpcontentprovider.cxx @@ -27,6 +27,7 @@ #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/factory.hxx> +#include <cppuhelper/weak.hxx> #include "ftpcontentprovider.hxx" #include "ftpcontent.hxx" #include "ftploaderthread.hxx" @@ -238,9 +239,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* ucb_ftp_FTPContentProvider_get_implementation( css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) { - static rtl::Reference<FTPContentProvider> g_Instance(new FTPContentProvider(context)); - g_Instance->acquire(); - return static_cast<cppu::OWeakObject*>(g_Instance.get()); + return cppu::acquire(static_cast<cppu::OWeakObject*>(new FTPContentProvider(context))); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucb/source/ucp/ftp/ucpftp1.component b/ucb/source/ucp/ftp/ucpftp1.component index 29fe0c0717b9..e71a0837d472 100644 --- a/ucb/source/ucp/ftp/ucpftp1.component +++ b/ucb/source/ucp/ftp/ucpftp1.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.FTPContentProvider" - constructor="ucb_ftp_FTPContentProvider_get_implementation"> + constructor="ucb_ftp_FTPContentProvider_get_implementation" single-instance="true"> <service name="com.sun.star.ucb.FTPContentProvider"/> </implementation> </component> diff --git a/ucb/source/ucp/gio/gio_provider.cxx b/ucb/source/ucp/gio/gio_provider.cxx index 21936f0db721..224ab0eacf88 100644 --- a/ucb/source/ucp/gio/gio_provider.cxx +++ b/ucb/source/ucp/gio/gio_provider.cxx @@ -21,6 +21,7 @@ #include <ucbhelper/contenthelper.hxx> #include <ucbhelper/macros.hxx> #include <cppuhelper/queryinterface.hxx> +#include <cppuhelper/weak.hxx> #include <com/sun/star/ucb/ContentCreationException.hpp> #include <com/sun/star/ucb/IllegalIdentifierException.hpp> #include "gio_provider.hxx" @@ -127,17 +128,12 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* ucb_gio_ContentProvider_get_implementation( css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) { - static bool bDisabled = isDisabled(); - if (bDisabled) + if (isDisabled()) return nullptr; - static rtl::Reference<gio::ContentProvider> g_Instance = [&]() { - #if !GLIB_CHECK_VERSION(2,36,0) - g_type_init(); - #endif - return new gio::ContentProvider(context); - }(); - g_Instance->acquire(); - return static_cast<cppu::OWeakObject*>(g_Instance.get()); +#if !GLIB_CHECK_VERSION(2,36,0) + g_type_init(); +#endif + return cppu::acquire(static_cast<cppu::OWeakObject*>(new gio::ContentProvider(context))); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucb/source/ucp/gio/ucpgio.component b/ucb/source/ucp/gio/ucpgio.component index e0cdaa7dc583..7d128067a8b8 100644 --- a/ucb/source/ucp/gio/ucpgio.component +++ b/ucb/source/ucp/gio/ucpgio.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.GIOContentProvider" - constructor="ucb_gio_ContentProvider_get_implementation"> + constructor="ucb_gio_ContentProvider_get_implementation" single-instance="true"> <service name="com.sun.star.ucb.GIOContentProvider"/> </implementation> </component> diff --git a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx index 8dcd90b9e641..8b61c375f896 100644 --- a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx +++ b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx @@ -31,6 +31,7 @@ #include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/queryinterface.hxx> +#include <cppuhelper/weak.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp> @@ -39,7 +40,6 @@ #include <com/sun/star/util/XChangesNotifier.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <ucbhelper/macros.hxx> -#include <rtl/ref.hxx> using namespace com::sun::star; using namespace hierarchy_ucp; @@ -212,9 +212,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* ucb_HierarchyDataSource_get_implementation( css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) { - static rtl::Reference<HierarchyDataSource> g_Instance(new HierarchyDataSource(context)); - g_Instance->acquire(); - return static_cast<cppu::OWeakObject*>(g_Instance.get()); + return cppu::acquire(static_cast<cppu::OWeakObject*>(new HierarchyDataSource(context))); } diff --git a/ucb/source/ucp/hierarchy/hierarchyprovider.cxx b/ucb/source/ucp/hierarchy/hierarchyprovider.cxx index 977ed4fb980d..c041a50a9f84 100644 --- a/ucb/source/ucp/hierarchy/hierarchyprovider.cxx +++ b/ucb/source/ucp/hierarchy/hierarchyprovider.cxx @@ -31,6 +31,7 @@ #include <com/sun/star/ucb/IllegalIdentifierException.hpp> #include <com/sun/star/util/theOfficeInstallationDirectories.hpp> #include <cppuhelper/queryinterface.hxx> +#include <cppuhelper/weak.hxx> #include <ucbhelper/contentidentifier.hxx> #include <ucbhelper/macros.hxx> #include "hierarchyprovider.hxx" @@ -115,9 +116,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* ucb_HierarchyContentProvider_get_implementation( css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) { - static rtl::Reference<HierarchyContentProvider> g_Instance(new HierarchyContentProvider(context)); - g_Instance->acquire(); - return static_cast<cppu::OWeakObject*>(g_Instance.get()); + return cppu::acquire(static_cast<cppu::OWeakObject*>(new HierarchyContentProvider(context))); } // XContentProvider methods. diff --git a/ucb/source/ucp/hierarchy/ucphier1.component b/ucb/source/ucp/hierarchy/ucphier1.component index 5122c5a63787..e403857c72e1 100644 --- a/ucb/source/ucp/hierarchy/ucphier1.component +++ b/ucb/source/ucp/hierarchy/ucphier1.component @@ -20,11 +20,11 @@ <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.ucb.HierarchyContentProvider" - constructor="ucb_HierarchyContentProvider_get_implementation"> + constructor="ucb_HierarchyContentProvider_get_implementation" single-instance="true"> <service name="com.sun.star.ucb.HierarchyContentProvider"/> </implementation> <implementation name="com.sun.star.comp.ucb.HierarchyDataSource" - constructor="ucb_HierarchyDataSource_get_implementation"> + constructor="ucb_HierarchyDataSource_get_implementation" single-instance="true"> <service name="com.sun.star.ucb.DefaultHierarchyDataSource"/> <service name="com.sun.star.ucb.HierarchyDataSource"/> </implementation> diff --git a/ucb/source/ucp/package/pkgprovider.cxx b/ucb/source/ucp/package/pkgprovider.cxx index 206224c30fda..30f8e47955b5 100644 --- a/ucb/source/ucp/package/pkgprovider.cxx +++ b/ucb/source/ucp/package/pkgprovider.cxx @@ -266,9 +266,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* ucb_package_ContentProvider_get_implementation( css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) { - static rtl::Reference<ContentProvider> g_Instance(new ContentProvider(context)); - g_Instance->acquire(); - return static_cast<cppu::OWeakObject*>(g_Instance.get()); + return cppu::acquire(static_cast<cppu::OWeakObject*>(new ContentProvider(context))); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucb/source/ucp/package/ucppkg1.component b/ucb/source/ucp/package/ucppkg1.component index 80959b5ef835..5bbf387a1529 100644 --- a/ucb/source/ucp/package/ucppkg1.component +++ b/ucb/source/ucp/package/ucppkg1.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.ucb.PackageContentProvider" - constructor="ucb_package_ContentProvider_get_implementation"> + constructor="ucb_package_ContentProvider_get_implementation" single-instance="true"> <service name="com.sun.star.ucb.PackageContentProvider"/> </implementation> </component> diff --git a/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx b/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx index c069fed082e0..0b9252922160 100644 --- a/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx +++ b/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx @@ -27,7 +27,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <cppuhelper/factory.hxx> #include <cppuhelper/supportsservice.hxx> -#include <rtl/ref.hxx> +#include <cppuhelper/weak.hxx> #include "tdoc_documentcontentfactory.hxx" @@ -109,9 +109,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* ucb_tdoc_DocumentContentFactory_get_implementation( css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) { - static rtl::Reference<DocumentContentFactory> g_Instance(new DocumentContentFactory(context)); - g_Instance->acquire(); - return static_cast<cppu::OWeakObject*>(g_Instance.get()); + return cppu::acquire(static_cast<cppu::OWeakObject*>(new DocumentContentFactory(context))); } diff --git a/ucb/source/ucp/tdoc/ucptdoc1.component b/ucb/source/ucp/tdoc/ucptdoc1.component index 331538c432f3..0ba43e266956 100644 --- a/ucb/source/ucp/tdoc/ucptdoc1.component +++ b/ucb/source/ucp/tdoc/ucptdoc1.component @@ -24,7 +24,7 @@ <service name="com.sun.star.ucb.TransientDocumentsContentProvider"/> </implementation> <implementation name="com.sun.star.comp.ucb.TransientDocumentsDocumentContentFactory" - constructor="ucb_tdoc_DocumentContentFactory_get_implementation"> + constructor="ucb_tdoc_DocumentContentFactory_get_implementation" single-instance="true"> <service name="com.sun.star.frame.TransientDocumentsDocumentContentFactory"/> </implementation> </component> |