summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2021-03-18 11:26:03 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-03-20 09:30:57 +0100
commitb7d10f138182b0f2d9b682582f73de8d6ceceb8d (patch)
tree59f7497436fd18a5ca9dba583a3bcb05bc0ff165 /framework
parent3e12b2fb64350938a3efe3252e84f62aa608356e (diff)
use single-use attribute for UICommandDescription
instead of rtl::Instance, which means it will get cleaned up when UNO shuts down Change-Id: Ia26871e1a2cf2cc6150d681f3a40b42269fb65c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112686 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework')
-rw-r--r--framework/source/uielement/uicommanddescription.cxx23
-rw-r--r--framework/util/fwk.component3
2 files changed, 3 insertions, 23 deletions
diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx
index d791ddfd89ab..4d9fccf5af41 100644
--- a/framework/source/uielement/uicommanddescription.cxx
+++ b/framework/source/uielement/uicommanddescription.cxx
@@ -710,33 +710,12 @@ sal_Bool SAL_CALL UICommandDescription::hasElements()
} // namespace framework
-namespace {
-
-struct Instance {
- explicit Instance(
- css::uno::Reference<css::uno::XComponentContext> const & context):
- instance(static_cast<cppu::OWeakObject *>(
- new framework::UICommandDescription(context)))
- {
- }
-
- css::uno::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_framework_UICommandDescription_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()));
+ return cppu::acquire(new framework::UICommandDescription(context));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index 12ce9ec7d966..5c9085759b19 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -161,7 +161,8 @@
<singleton name="com.sun.star.ui.theUICategoryDescription"/>
</implementation>
<implementation name="com.sun.star.comp.framework.UICommandDescription"
- constructor="com_sun_star_comp_framework_UICommandDescription_get_implementation">
+ constructor="com_sun_star_comp_framework_UICommandDescription_get_implementation"
+ single-instance="true">
<service name="com.sun.star.frame.UICommandDescription"/>
<singleton name="com.sun.star.frame.theUICommandDescription"/>
</implementation>