From 00194781efcafa231ac53ba26c84e2df847cf5e7 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 21 Feb 2023 12:41:58 +0200 Subject: fix locking in configmgr::configuration_provider::Service a mistake from commit a61951a3a21c6457334f78f657806c1167dbf339 Author: Noel Grandin Date: Mon Feb 20 20:08:30 2023 +0200 BaseMutex->std::mutex in configmgr::configuration_provider::Service Change-Id: I59c670ea7bffacb9dcd1f073b5da2439c2102a45 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147392 Tested-by: Jenkins Reviewed-by: Noel Grandin --- configmgr/source/configurationprovider.cxx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'configmgr') diff --git a/configmgr/source/configurationprovider.cxx b/configmgr/source/configurationprovider.cxx index ddff084a1b03..215cad7f6f14 100644 --- a/configmgr/source/configurationprovider.cxx +++ b/configmgr/source/configurationprovider.cxx @@ -106,7 +106,7 @@ private: virtual ~Service() override {} - virtual void disposing(std::unique_lock& rGuard) override { flushModifications(rGuard); } + virtual void disposing(std::unique_lock& /*rGuard*/) override { flushModifications(); } virtual OUString SAL_CALL getImplementationName() override { @@ -157,7 +157,7 @@ private: virtual css::lang::Locale SAL_CALL getLocale() override; - void flushModifications(std::unique_lock& rGuard) const; + void flushModifications() const; css::uno::Reference< css::uno::XComponentContext > context_; OUString locale_; @@ -293,8 +293,8 @@ void Service::removeRefreshListener( } void Service::flush() { + flushModifications(); std::unique_lock g(m_aMutex); - flushModifications(g); if (maFlushListeners.getLength(g)) { css::lang::EventObject ev(static_cast< cppu::OWeakObject * >(this)); maFlushListeners.notifyEach(g, &css::util::XFlushListener::flushed, ev); @@ -330,11 +330,13 @@ css::lang::Locale Service::getLocale() { return loc; } -void Service::flushModifications(std::unique_lock& rGuard) const { - Components * components = &Components::getSingleton(context_); - rGuard.unlock(); +void Service::flushModifications() const { + Components * components; + { + osl::MutexGuard guard(*lock_); + components = &Components::getSingleton(context_); + } components->flushModifications(); - rGuard.lock(); } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* -- cgit