summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--framework/source/accelerators/globalacceleratorconfiguration.cxx23
1 files changed, 17 insertions, 6 deletions
diff --git a/framework/source/accelerators/globalacceleratorconfiguration.cxx b/framework/source/accelerators/globalacceleratorconfiguration.cxx
index ba5a2e407b8e..d8d1f859ceb7 100644
--- a/framework/source/accelerators/globalacceleratorconfiguration.cxx
+++ b/framework/source/accelerators/globalacceleratorconfiguration.cxx
@@ -111,6 +111,22 @@ 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 * SAL_CALL
@@ -118,12 +134,7 @@ com_sun_star_comp_framework_GlobalAcceleratorConfiguration_get_implementation(
css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
{
- GlobalAcceleratorConfiguration *inst = new GlobalAcceleratorConfiguration(context);
- css::uno::XInterface *acquired_inst = cppu::acquire(inst);
-
- inst->fillCache();
-
- return acquired_inst;
+ return cppu::acquire(static_cast<cppu::OWeakObject*>(Singleton::get(context).instance.get()));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */