summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-02-14 11:32:24 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-02-14 10:45:43 +0000
commit20f3339834bedd4a62731f69c954dc6e6607bec5 (patch)
treece978294fb34043dad24081e34b2bfbcd2e4bf37 /ucb
parent85d1ead3f9f23f78db0eee161eb0fc199d4b766c (diff)
fix locking in PersistentPropertySet
after commit 756185b5795c95180d32d02abfbd65951779b40e Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Mon Feb 13 09:06:02 2023 +0200 osl::Mutex->std::mutex in PersistentPropertySet Change-Id: Ie52432ea1566b840bd88692f00f4753eea7896f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146998 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/core/ucbstore.cxx34
-rw-r--r--ucb/source/core/ucbstore.hxx2
2 files changed, 15 insertions, 21 deletions
diff --git a/ucb/source/core/ucbstore.cxx b/ucb/source/core/ucbstore.cxx
index 191605dd1f7f..65c0e531e2e2 100644
--- a/ucb/source/core/ucbstore.cxx
+++ b/ucb/source/core/ucbstore.cxx
@@ -1187,10 +1187,7 @@ void SAL_CALL PersistentPropertySet::setPropertyValue( const OUString& aProperty
aEvt.OldValue = aOldValue;
aEvt.NewValue = aValue;
- // Callback follows!
- aCGuard.unlock();
-
- notifyPropertyChangeEvent( aEvt );
+ notifyPropertyChangeEvent( aCGuard, aEvt );
}
return;
}
@@ -1442,7 +1439,7 @@ void SAL_CALL PersistentPropertySet::addProperty(
Name,
-1,
PropertySetInfoChange::PROPERTY_INSERTED );
- notifyPropertySetInfoChange( evt );
+ notifyPropertySetInfoChange(aGuard, evt);
}
// Success.
@@ -1600,7 +1597,7 @@ void SAL_CALL PersistentPropertySet::removeProperty( const OUString& Name )
Name,
nHandle,
PropertySetInfoChange::PROPERTY_REMOVED );
- notifyPropertySetInfoChange( evt );
+ notifyPropertySetInfoChange( aGuard, evt );
}
// Success.
@@ -1883,13 +1880,10 @@ void SAL_CALL PersistentPropertySet::setPropertyValues(
if ( m_pPropertyChangeListeners )
{
- // Callback follows!
- aCGuard.unlock();
-
// Notify property changes.
for (auto const& event : aEvents)
{
- notifyPropertyChangeEvent( event );
+ notifyPropertyChangeEvent( aCGuard, event );
}
}
@@ -1904,38 +1898,36 @@ void SAL_CALL PersistentPropertySet::setPropertyValues(
void PersistentPropertySet::notifyPropertyChangeEvent(
+ std::unique_lock<std::mutex>& rGuard,
const PropertyChangeEvent& rEvent ) const
{
- std::unique_lock aGuard(m_aMutex);
-
// Get "normal" listeners for the property.
OInterfaceContainerHelper4<XPropertyChangeListener>* pContainer =
- m_pPropertyChangeListeners->getContainer( aGuard, rEvent.PropertyName );
- if ( pContainer && pContainer->getLength(aGuard) )
+ m_pPropertyChangeListeners->getContainer( rGuard, rEvent.PropertyName );
+ if ( pContainer && pContainer->getLength(rGuard) )
{
- pContainer->notifyEach( aGuard, &XPropertyChangeListener::propertyChange, rEvent );
+ pContainer->notifyEach( rGuard, &XPropertyChangeListener::propertyChange, rEvent );
}
// Get "normal" listeners for all properties.
OInterfaceContainerHelper4<XPropertyChangeListener>* pNoNameContainer =
- m_pPropertyChangeListeners->getContainer( aGuard, OUString() );
- if ( pNoNameContainer && pNoNameContainer->getLength(aGuard) )
+ m_pPropertyChangeListeners->getContainer( rGuard, OUString() );
+ if ( pNoNameContainer && pNoNameContainer->getLength(rGuard) )
{
- pNoNameContainer->notifyEach( aGuard, &XPropertyChangeListener::propertyChange, rEvent );
+ pNoNameContainer->notifyEach( rGuard, &XPropertyChangeListener::propertyChange, rEvent );
}
}
void PersistentPropertySet::notifyPropertySetInfoChange(
+ std::unique_lock<std::mutex>& rGuard,
const PropertySetInfoChangeEvent& evt ) const
{
- std::unique_lock aGuard(m_aMutex);
-
if ( !m_pPropSetChangeListeners )
return;
// Notify event listeners.
- m_pPropSetChangeListeners->notifyEach( aGuard, &XPropertySetInfoChangeListener::propertySetInfoChange, evt );
+ m_pPropSetChangeListeners->notifyEach( rGuard, &XPropertySetInfoChangeListener::propertySetInfoChange, evt );
}
diff --git a/ucb/source/core/ucbstore.hxx b/ucb/source/core/ucbstore.hxx
index dceb65733864..5f431fa8ac0d 100644
--- a/ucb/source/core/ucbstore.hxx
+++ b/ucb/source/core/ucbstore.hxx
@@ -169,8 +169,10 @@ class PersistentPropertySet : public cppu::WeakImplHelper <
private:
void notifyPropertyChangeEvent(
+ std::unique_lock<std::mutex>& rGuard,
const css::beans::PropertyChangeEvent& rEvent ) const;
void notifyPropertySetInfoChange(
+ std::unique_lock<std::mutex>& rGuard,
const css::beans::PropertySetInfoChangeEvent& evt ) const;
public: