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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Mar 22 15:06:24 UTC 2021


 framework/source/accelerators/globalacceleratorconfiguration.cxx |   20 +---------
 framework/util/fwk.component                                     |    3 +
 2 files changed, 5 insertions(+), 18 deletions(-)

New commits:
commit dfc3f0b640710b144479b65b8394ed29f96138fd
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Mar 21 18:38:02 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Mar 22 16:05:21 2021 +0100

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

diff --git a/framework/source/accelerators/globalacceleratorconfiguration.cxx b/framework/source/accelerators/globalacceleratorconfiguration.cxx
index 359fbcd5be42..e54a05a03be3 100644
--- a/framework/source/accelerators/globalacceleratorconfiguration.cxx
+++ b/framework/source/accelerators/globalacceleratorconfiguration.cxx
@@ -109,22 +109,6 @@ void GlobalAcceleratorConfiguration::fillCache()
         {}
 }
 
-struct Instance
-{
-    explicit Instance(css::uno::Reference<css::uno::XComponentContext> const & context)
-        : instance(new GlobalAcceleratorConfiguration(context))
-    {
-        instance->fillCache();
-    }
-
-    rtl::Reference<GlobalAcceleratorConfiguration> instance;
-};
-
-struct Singleton:
-    public rtl::StaticWithArg<
-        Instance, css::uno::Reference<css::uno::XComponentContext>, Singleton>
-{};
-
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
@@ -132,7 +116,9 @@ com_sun_star_comp_framework_GlobalAcceleratorConfiguration_get_implementation(
     css::uno::XComponentContext *context,
     css::uno::Sequence<css::uno::Any> const &)
 {
-    return cppu::acquire(static_cast<cppu::OWeakObject*>(Singleton::get(context).instance.get()));
+    rtl::Reference<GlobalAcceleratorConfiguration> xGAC = new GlobalAcceleratorConfiguration(context);
+    xGAC->fillCache();
+    return cppu::acquire(xGAC.get());
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index d695aef4841a..bb74eb817d12 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -55,7 +55,8 @@
     <service name="com.sun.star.frame.Frame"/>
   </implementation>
   <implementation name="com.sun.star.comp.framework.GlobalAcceleratorConfiguration"
-      constructor="com_sun_star_comp_framework_GlobalAcceleratorConfiguration_get_implementation">
+      constructor="com_sun_star_comp_framework_GlobalAcceleratorConfiguration_get_implementation"
+      single-instance="true">
     <service name="com.sun.star.ui.GlobalAcceleratorConfiguration"/>
   </implementation>
   <implementation name="com.sun.star.comp.framework.ImageManager"


More information about the Libreoffice-commits mailing list