framework/source/services/pathsettings.cxx | 27 ++++++--------------------- framework/util/fwk.component | 3 ++- 2 files changed, 8 insertions(+), 22 deletions(-)
New commits: commit cd596ebc8ecc1ac303c4c3481c541cb52afa32bb Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Sun Mar 21 13:25:15 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Mar 22 16:05:07 2021 +0100 use single-use attribute for PathSettings instead of rtl::Instance, which means it will get cleaned up when UNO shuts down Change-Id: I90f7e0af8ce67cdcef2df7b28c7e55b1c92aad3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112834 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx index c59ef728ccb5..b58091294231 100644 --- a/framework/source/services/pathsettings.cxx +++ b/framework/source/services/pathsettings.cxx @@ -40,6 +40,7 @@ #include <tools/urlobj.hxx> #include <rtl/ustrbuf.hxx> +#include <rtl/ref.hxx> #include <sal/log.hxx> #include <cppuhelper/basemutex.hxx> @@ -1409,25 +1410,6 @@ css::uno::Reference< css::container::XNameAccess > PathSettings::fa_getCfgNew() return xCfg; } -struct Instance { - explicit Instance( - css::uno::Reference<css::uno::XComponentContext> const & context): - instance( - static_cast<cppu::OWeakObject *>(new PathSettings(context))) - { - // fill cache - static_cast<PathSettings *>(static_cast<cppu::OWeakObject *> - (instance.get()))->impl_readAll(); - } - - 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 * @@ -1435,8 +1417,11 @@ com_sun_star_comp_framework_PathSettings_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<PathSettings> xPathSettings = new PathSettings(context); + // fill cache + xPathSettings->impl_readAll(); + + return cppu::acquire(xPathSettings.get()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/util/fwk.component b/framework/util/fwk.component index c20c9a30c0e2..d695aef4841a 100644 --- a/framework/util/fwk.component +++ b/framework/util/fwk.component @@ -104,7 +104,8 @@ <service name="com.sun.star.frame.PopupMenuController"/> </implementation> <implementation name="com.sun.star.comp.framework.PathSettings" - constructor="com_sun_star_comp_framework_PathSettings_get_implementation"> + constructor="com_sun_star_comp_framework_PathSettings_get_implementation" + single-instance="true"> <service name="com.sun.star.util.PathSettings"/> <singleton name="com.sun.star.util.thePathSettings"/> </implementation> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits