summaryrefslogtreecommitdiff
path: root/animations
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2023-05-05 21:00:24 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-05-07 08:00:46 +0200
commit31e2b4746a4a5d7661c4aa8f6a4489e50982aede (patch)
tree51b30c8370df279acd636e599028d01b72cab5f1 /animations
parent50deb478e97aa9cfd023c5fa2f9d567b0b5797c2 (diff)
improve some usage of OInterfaceIteratorHelper4
we can drop the lock immediately after construction (since the iterator holds a thread-safe COW link to the underlying listener container) Change-Id: I08f8fa9ed7393747938572097f3c25f5f3f847fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151440 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'animations')
-rw-r--r--animations/source/animcore/animcore.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/animations/source/animcore/animcore.cxx b/animations/source/animcore/animcore.cxx
index 09a2e793b2c0..03c815021c93 100644
--- a/animations/source/animcore/animcore.cxx
+++ b/animations/source/animcore/animcore.cxx
@@ -2076,14 +2076,16 @@ void SAL_CALL AnimationNode::removeChangesListener( const Reference< XChangesLis
void AnimationNode::fireChangeListener(std::unique_lock<std::mutex>& l)
{
- OInterfaceIteratorHelper4 aIterator( l, maChangeListener );
- if( aIterator.hasMoreElements() )
+ if( maChangeListener.getLength(l) != 0 )
{
Reference< XInterface > xSource( static_cast<OWeakObject*>(this), UNO_QUERY );
Sequence< ElementChange > aChanges;
const ChangesEvent aEvent( xSource, Any( css::uno::Reference<XInterface>(static_cast<cppu::OWeakObject*>(mxParent.get().get())) ), aChanges );
+ OInterfaceIteratorHelper4 aIterator( l, maChangeListener );
+ l.unlock();
while( aIterator.hasMoreElements() )
aIterator.next()->changesOccurred( aEvent );
+ l.lock();
}
//fdo#69645 use WeakReference of mxParent to test if mpParent is still valid