diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-03-18 11:19:21 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-03-19 17:37:07 +0100 |
commit | f5784794f4cecd4fd57a803191b544f80f7ba02e (patch) | |
tree | fd49d6d5078317d18ad1fd7933201c8318265bcf | |
parent | 22e4f7a348f82fae7eefae5b67de3d829dceadcb (diff) |
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 <noel.grandin@collabora.co.uk>
-rw-r--r-- | framework/source/uifactory/uielementfactorymanager.cxx | 19 | ||||
-rw-r--r-- | 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<css::uno::XComponentContext> const & context): - instance(static_cast<cppu::OWeakObject *>( - new UIElementFactoryManager(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 * @@ -565,8 +549,7 @@ com_sun_star_comp_framework_UIElementFactoryManager_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 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 @@ <service name="com.sun.star.ui.UIConfigurationManager"/> </implementation> <implementation name="com.sun.star.comp.framework.UIElementFactoryManager" - constructor="com_sun_star_comp_framework_UIElementFactoryManager_get_implementation"> + constructor="com_sun_star_comp_framework_UIElementFactoryManager_get_implementation" + single-instance="true"> <service name="com.sun.star.ui.UIElementFactoryManager"/> <singleton name="com.sun.star.ui.theUIElementFactoryManager"/> </implementation> |