basic/source/classes/sbxmod.cxx | 2 +- framework/inc/helper/propertysetcontainer.hxx | 3 ++- framework/source/fwe/helper/propertysetcontainer.cxx | 12 +++++++----- 3 files changed, 10 insertions(+), 7 deletions(-)
New commits: commit ec4babad021218b75dfe8534985d7db525edde69 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Sun Jan 29 19:09:31 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun Jan 29 18:03:48 2023 +0000 no need to lock SolarMutex over the whole method here Change-Id: Ifcac67c0f4e149fe7e1d923d7efede9552b034a8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146308 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 00bfac58dd71..f38e729185db 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -2375,9 +2375,9 @@ public: virtual void SAL_CALL documentEventOccured( const document::DocumentEvent& rEvent ) override { // early disposing on document event "OnUnload", to be sure Basic still exists when calling VBA "UserForm_Terminate" - SolarMutexGuard g; if( rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::CLOSEDOC ) ) { + SolarMutexGuard g; removeListener(); mbDisposed = true; if ( mpUserForm ) commit 6a26d47a79615c6b91b298937cdfee2f5294a58b Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Sun Jan 29 19:01:17 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun Jan 29 18:03:38 2023 +0000 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.gran...@collabora.co.uk> 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() ); }