summaryrefslogtreecommitdiff
path: root/configmgr
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-02-21 12:41:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-02-21 11:58:51 +0000
commit00194781efcafa231ac53ba26c84e2df847cf5e7 (patch)
tree470cd598c32a4f04c1dd975050a6ec99048713a2 /configmgr
parent9c978e4c75e342b2345ff4fcbd1b5751627d8baf (diff)
fix locking in configmgr::configuration_provider::Service
a mistake from commit a61951a3a21c6457334f78f657806c1167dbf339 Author: Noel Grandin <noel.grandin@collabora.co.uk> 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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'configmgr')
-rw-r--r--configmgr/source/configurationprovider.cxx16
1 files changed, 9 insertions, 7 deletions
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<std::mutex>& rGuard) override { flushModifications(rGuard); }
+ virtual void disposing(std::unique_lock<std::mutex>& /*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<std::mutex>& 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<std::mutex>& 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*