summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-03-22 13:41:53 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-03-23 09:08:03 +0100
commitf4d195fdda834cb51912f97a72d3f7b8c72420ef (patch)
tree432d560c62915738fdbf07b2bed76873ab6382d1 /unotools
parent109420d42027cc9d614117226abd72a2e9b8cdce (diff)
use single-use attribute for ServiceDocumenter
instead of rtl::Instance, which means it will get cleaned up when UNO shuts down Change-Id: I90f23e9439a7478e28cd466545ed498dfaf6e4de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112928 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/misc/ServiceDocumenter.cxx20
-rw-r--r--unotools/util/utl.component3
2 files changed, 3 insertions, 20 deletions
diff --git a/unotools/source/misc/ServiceDocumenter.cxx b/unotools/source/misc/ServiceDocumenter.cxx
index 39d4ba2907e4..695272641080 100644
--- a/unotools/source/misc/ServiceDocumenter.cxx
+++ b/unotools/source/misc/ServiceDocumenter.cxx
@@ -82,27 +82,9 @@ css::uno::Sequence< OUString > unotools::misc::ServiceDocumenter::getSupportedSe
}
-namespace {
-
-struct Instance {
- explicit Instance(
- css::uno::Reference<css::uno::XComponentContext> const & context):
- instance(new unotools::misc::ServiceDocumenter(context))
- {}
-
- rtl::Reference<unotools::misc::ServiceDocumenter> instance;
-};
-
-struct Singleton:
- public rtl::StaticWithArg<
- Instance, css::uno::Reference<css::uno::XComponentContext>, Singleton>
-{};
-
-}
-
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
unotools_ServiceDocument_get_implementation(
css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
{
- return cppu::acquire(Singleton::get(context).instance.get());
+ return cppu::acquire(new unotools::misc::ServiceDocumenter(context));
}
diff --git a/unotools/util/utl.component b/unotools/util/utl.component
index effef2146729..cd31d1c3e3cc 100644
--- a/unotools/util/utl.component
+++ b/unotools/util/utl.component
@@ -24,7 +24,8 @@
<service name="com.sun.star.io.TempFile"/>
</implementation>
<implementation name="com.sun.star.comp.unotools.misc.ServiceDocumenter"
- constructor="unotools_ServiceDocument_get_implementation">
+ constructor="unotools_ServiceDocument_get_implementation"
+ single-instance="true">
<singleton name="com.sun.star.util.theServiceDocumenter"/>
</implementation>
</component>