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

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


 comphelper/source/misc/officerestartmanager.cxx |   20 +-------------------
 comphelper/util/comphelp.component              |    3 ++-
 2 files changed, 3 insertions(+), 20 deletions(-)

New commits:
commit e657ec8449d306e9c04801e9db3552b96a8a8dd9
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Mar 22 13:33:27 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Mar 23 07:40:23 2021 +0100

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

diff --git a/comphelper/source/misc/officerestartmanager.cxx b/comphelper/source/misc/officerestartmanager.cxx
index f56486858522..ad6e308d2819 100644
--- a/comphelper/source/misc/officerestartmanager.cxx
+++ b/comphelper/source/misc/officerestartmanager.cxx
@@ -146,31 +146,13 @@ uno::Sequence< OUString > SAL_CALL OOfficeRestartManager::getSupportedServiceNam
 
 } // namespace comphelper
 
-namespace {
-
-struct Instance {
-    explicit Instance(
-        css::uno::Reference<css::uno::XComponentContext> const & context):
-        instance(static_cast<cppu::OWeakObject *>(new comphelper::OOfficeRestartManager(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_task_OfficeRestartManager(
     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::OOfficeRestartManager(context));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/comphelper/util/comphelp.component b/comphelper/util/comphelp.component
index 705e870eb5e0..10bc0cfe0ccd 100644
--- a/comphelper/util/comphelp.component
+++ b/comphelper/util/comphelp.component
@@ -52,7 +52,8 @@
     <service name="com.sun.star.embed.InstanceLocker"/>
   </implementation>
   <implementation name="com.sun.star.comp.task.OfficeRestartManager"
-      constructor="com_sun_star_comp_task_OfficeRestartManager">
+      constructor="com_sun_star_comp_task_OfficeRestartManager"
+      single-instance="true">
     <service name="com.sun.star.comp.task.OfficeRestartManager"/>
     <singleton name="com.sun.star.task.OfficeRestartManager"/>
   </implementation>


More information about the Libreoffice-commits mailing list