[Libreoffice-commits] core.git: unotools/source unotools/util

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 23 08:08:50 UTC 2021


 unotools/source/misc/ServiceDocumenter.cxx |   20 +-------------------
 unotools/util/utl.component                |    3 ++-
 2 files changed, 3 insertions(+), 20 deletions(-)

New commits:
commit f4d195fdda834cb51912f97a72d3f7b8c72420ef
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Mar 22 13:41:53 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Mar 23 09:08:03 2021 +0100

    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 at collabora.co.uk>

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>


More information about the Libreoffice-commits mailing list