filter/source/config/cache/cacheupdatelistener.cxx | 14 +++++++------- filter/source/config/cache/cacheupdatelistener.hxx | 6 ++++-- 2 files changed, 11 insertions(+), 9 deletions(-)
New commits: commit 825066456efcad3d160bfc08dde5f2f2eaa7850a Author: Noel Grandin <[email protected]> AuthorDate: Sat May 7 13:07:56 2022 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sat May 7 18:00:56 2022 +0200 osl::Mutex->std::mutex in filter::config::CacheUpdateListener Change-Id: Ib791be8495f2ad2855cceb94d45f2bd0995e3710 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133975 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/filter/source/config/cache/cacheupdatelistener.cxx b/filter/source/config/cache/cacheupdatelistener.cxx index 14331a190c2d..36e2ac160530 100644 --- a/filter/source/config/cache/cacheupdatelistener.cxx +++ b/filter/source/config/cache/cacheupdatelistener.cxx @@ -46,9 +46,9 @@ CacheUpdateListener::~CacheUpdateListener() void CacheUpdateListener::startListening() { // SAFE -> - osl::ClearableMutexGuard aLock(m_aMutex); + std::unique_lock aLock(m_aMutex); css::uno::Reference< css::util::XChangesNotifier > xNotifier(m_xConfig, css::uno::UNO_QUERY); - aLock.clear(); + aLock.unlock(); // <- SAFE if (!xNotifier.is()) @@ -62,9 +62,9 @@ void CacheUpdateListener::startListening() void CacheUpdateListener::stopListening() { // SAFE -> - osl::ClearableMutexGuard aLock(m_aMutex); + std::unique_lock aLock(m_aMutex); css::uno::Reference< css::util::XChangesNotifier > xNotifier(m_xConfig, css::uno::UNO_QUERY); - aLock.clear(); + aLock.unlock(); // <- SAFE if (!xNotifier.is()) @@ -78,7 +78,7 @@ void CacheUpdateListener::stopListening() void SAL_CALL CacheUpdateListener::changesOccurred(const css::util::ChangesEvent& aEvent) { // SAFE -> - osl::ClearableMutexGuard aLock(m_aMutex); + std::unique_lock aLock(m_aMutex); // disposed ? if ( ! m_xConfig.is()) @@ -86,7 +86,7 @@ void SAL_CALL CacheUpdateListener::changesOccurred(const css::util::ChangesEven FilterCache::EItemType eType = m_eConfigType; - aLock.clear(); + aLock.unlock(); // <- SAFE std::vector<OUString> lChangedItems; @@ -172,7 +172,7 @@ void SAL_CALL CacheUpdateListener::changesOccurred(const css::util::ChangesEven void SAL_CALL CacheUpdateListener::disposing(const css::lang::EventObject& aEvent) { // SAFE -> - osl::MutexGuard aLock(m_aMutex); + std::unique_lock aLock(m_aMutex); if (aEvent.Source == m_xConfig) m_xConfig.clear(); // <- SAFE diff --git a/filter/source/config/cache/cacheupdatelistener.hxx b/filter/source/config/cache/cacheupdatelistener.hxx index ff7e02759363..fc0789af8dec 100644 --- a/filter/source/config/cache/cacheupdatelistener.hxx +++ b/filter/source/config/cache/cacheupdatelistener.hxx @@ -21,6 +21,7 @@ #include "filtercache.hxx" #include <com/sun/star/util/XChangesListener.hpp> #include <cppuhelper/implbase.hxx> +#include <mutex> namespace filter::config { @@ -30,14 +31,15 @@ namespace filter::config { global filter cache, if the underlying configuration wa changed by other processes. */ -class CacheUpdateListener : public cppu::BaseMutex // must be the first one to guarantee right initialized mutex member! - , public ::cppu::WeakImplHelper< css::util::XChangesListener > +class CacheUpdateListener : public ::cppu::WeakImplHelper< css::util::XChangesListener > { // member private: + std::mutex m_aMutex; + /** @short reference to the singleton(!) filter cache implementation, which should be updated by this thread. */ FilterCache &m_rCache;
