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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 23 06:42:29 UTC 2021


 comphelper/source/officeinstdir/officeinstallationdirectories.cxx |   22 ----------
 comphelper/util/comphelp.component                                |    3 -
 2 files changed, 4 insertions(+), 21 deletions(-)

New commits:
commit fb6443a17dd676cc50560c7ac91e5e3106138222
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Mar 22 13:31:00 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Mar 23 07:41:50 2021 +0100

    use single-use attribute for OfficeInstallationDirectories
    
    instead of rtl::Instance, which means it will get
    cleaned up when UNO shuts down
    
    Change-Id: If6b0a41d0a8a20ea4989771d83833288c6bd3234
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112926
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
index 1bee23622d42..385f61680e1c 100644
--- a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
+++ b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
@@ -236,32 +236,14 @@ void OfficeInstallationDirectories::initDirs()
 
 }
 
-namespace {
-
-struct Instance {
-    explicit Instance(
-        css::uno::Reference<css::uno::XComponentContext> const & context):
-        instance(static_cast<cppu::OWeakObject *>(
-            new comphelper::OfficeInstallationDirectories(context)))
-    {}
-
-    rtl::Reference<css::uno::XInterface> instance;
-};
-
-struct Singleton:
-    public rtl::StaticWithArg<
-        Instance, css::uno::Reference<css::uno::XComponentContext>, Singleton>
-{};
-
-}
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
 com_sun_star_comp_util_OfficeInstallationDirectories(
     css::uno::XComponentContext *context,
     css::uno::Sequence<css::uno::Any> const &)
 {
-    return cppu::acquire(static_cast<cppu::OWeakObject *>(
-                Singleton::get(context).instance.get()));
+    return cppu::acquire(
+            new comphelper::OfficeInstallationDirectories(context));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/comphelper/util/comphelp.component b/comphelper/util/comphelp.component
index 10bc0cfe0ccd..1e4e0c8fbf8e 100644
--- a/comphelper/util/comphelp.component
+++ b/comphelper/util/comphelp.component
@@ -58,7 +58,8 @@
     <singleton name="com.sun.star.task.OfficeRestartManager"/>
   </implementation>
   <implementation name="com.sun.star.comp.util.OfficeInstallationDirectories"
-      constructor="com_sun_star_comp_util_OfficeInstallationDirectories">
+      constructor="com_sun_star_comp_util_OfficeInstallationDirectories"
+      single-instance="true">
     <service name="com.sun.star.util.OfficeInstallationDirectories"/>
     <singleton name="com.sun.star.util.theOfficeInstallationDirectories"/>
   </implementation>


More information about the Libreoffice-commits mailing list