summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-03-21 18:38:02 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-03-22 16:05:21 +0100
commitdfc3f0b640710b144479b65b8394ed29f96138fd (patch)
tree044533141c1b83dbf6db4056135b51c34e35af15 /framework
parentcd596ebc8ecc1ac303c4c3481c541cb52afa32bb (diff)
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@collabora.co.uk>
Diffstat (limited to 'framework')
-rw-r--r--framework/source/accelerators/globalacceleratorconfiguration.cxx20
-rw-r--r--framework/util/fwk.component3
2 files changed, 5 insertions, 18 deletions
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"