diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2023-01-29 19:01:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-29 18:03:38 +0000 |
commit | 6a26d47a79615c6b91b298937cdfee2f5294a58b (patch) | |
tree | 36d985674bf43d7d334efb45cd83f5a8ac9c6896 | |
parent | 5583d5c71495402eeba568b36588cba345f4a623 (diff) |
use std:mutex in PropertySetContainer
instead of SolarMutex, we don't need to lock SolarMutex here,
we are not touching any UI stuff
Change-Id: I09f2dfd2c5e6e082066a726f8c6d64b4b136a78d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146307
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | framework/inc/helper/propertysetcontainer.hxx | 3 | ||||
-rw-r--r-- | framework/source/fwe/helper/propertysetcontainer.cxx | 12 |
2 files changed, 9 insertions, 6 deletions
diff --git a/framework/inc/helper/propertysetcontainer.hxx b/framework/inc/helper/propertysetcontainer.hxx index 75c8414c3698..849899784c64 100644 --- a/framework/inc/helper/propertysetcontainer.hxx +++ b/framework/inc/helper/propertysetcontainer.hxx @@ -21,6 +21,7 @@ #include <sal/config.h> +#include <mutex> #include <vector> #include <cppuhelper/weak.hxx> #include <com/sun/star/container/XIndexContainer.hpp> @@ -65,7 +66,7 @@ class PropertySetContainer : public css::container::XIndexContainer , private: typedef std::vector< css::uno::Reference< css::beans::XPropertySet > > PropertySetVector; PropertySetVector m_aPropertySetVector; - + std::mutex m_aMutex; }; } diff --git a/framework/source/fwe/helper/propertysetcontainer.cxx b/framework/source/fwe/helper/propertysetcontainer.cxx index ad7d639539b7..2fcd07a53fde 100644 --- a/framework/source/fwe/helper/propertysetcontainer.cxx +++ b/framework/source/fwe/helper/propertysetcontainer.cxx @@ -73,7 +73,7 @@ Any SAL_CALL PropertySetContainer::queryInterface( const Type& rType ) // XIndexContainer void SAL_CALL PropertySetContainer::insertByIndex( sal_Int32 Index, const css::uno::Any& Element ) { - SolarMutexGuard g; + std::unique_lock g(m_aMutex); sal_Int32 nSize = m_aPropertySetVector.size(); @@ -101,7 +101,7 @@ void SAL_CALL PropertySetContainer::insertByIndex( sal_Int32 Index, const css::u void SAL_CALL PropertySetContainer::removeByIndex( sal_Int32 nIndex ) { - SolarMutexGuard g; + std::unique_lock g(m_aMutex); if ( static_cast<sal_Int32>(m_aPropertySetVector.size()) <= nIndex ) throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) ); @@ -112,6 +112,8 @@ void SAL_CALL PropertySetContainer::removeByIndex( sal_Int32 nIndex ) // XIndexReplace void SAL_CALL PropertySetContainer::replaceByIndex( sal_Int32 Index, const css::uno::Any& Element ) { + std::unique_lock g(m_aMutex); + if ( static_cast<sal_Int32>(m_aPropertySetVector.size()) <= Index ) throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) ); @@ -130,14 +132,14 @@ void SAL_CALL PropertySetContainer::replaceByIndex( sal_Int32 Index, const css:: // XIndexAccess sal_Int32 SAL_CALL PropertySetContainer::getCount() { - SolarMutexGuard g; + std::unique_lock g(m_aMutex); return m_aPropertySetVector.size(); } Any SAL_CALL PropertySetContainer::getByIndex( sal_Int32 Index ) { - SolarMutexGuard g; + std::unique_lock g(m_aMutex); if ( static_cast<sal_Int32>(m_aPropertySetVector.size()) <= Index ) throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) ); @@ -148,7 +150,7 @@ Any SAL_CALL PropertySetContainer::getByIndex( sal_Int32 Index ) // XElementAccess sal_Bool SAL_CALL PropertySetContainer::hasElements() { - SolarMutexGuard g; + std::unique_lock g(m_aMutex); return !( m_aPropertySetVector.empty() ); } |