From f5784794f4cecd4fd57a803191b544f80f7ba02e Mon Sep 17 00:00:00 2001 From: Noel Date: Thu, 18 Mar 2021 11:19:21 +0200 Subject: use single-use attribute for UIElementFactoryManager instead of rtl::Instance, which means it will get cleaned up when UNO shuts down Change-Id: I52193861c4b2e07c3655773c8d185b2036336da2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112682 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../source/uifactory/uielementfactorymanager.cxx | 19 +------------------ framework/util/fwk.component | 3 ++- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx index 02d5435bab80..b1567724ff06 100644 --- a/framework/source/uifactory/uielementfactorymanager.cxx +++ b/framework/source/uifactory/uielementfactorymanager.cxx @@ -542,22 +542,6 @@ void SAL_CALL UIElementFactoryManager::deregisterFactory( const OUString& aType, // SAFE } -struct Instance { - explicit Instance( - css::uno::Reference const & context): - instance(static_cast( - new UIElementFactoryManager(context))) - { - } - - css::uno::Reference instance; -}; - -struct Singleton: - public rtl::StaticWithArg< - Instance, css::uno::Reference, Singleton> -{}; - } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * @@ -565,8 +549,7 @@ com_sun_star_comp_framework_UIElementFactoryManager_get_implementation( css::uno::XComponentContext *context, css::uno::Sequence const &) { - return cppu::acquire(static_cast( - Singleton::get(context).instance.get())); + return cppu::acquire(new UIElementFactoryManager(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/util/fwk.component b/framework/util/fwk.component index d6ca2652d3cf..9f050373c603 100644 --- a/framework/util/fwk.component +++ b/framework/util/fwk.component @@ -166,7 +166,8 @@ + constructor="com_sun_star_comp_framework_UIElementFactoryManager_get_implementation" + single-instance="true"> -- cgit