summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-01-14 10:56:50 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-01-14 21:04:10 +0100
commita2eaf99e46f370ffb3b73828c2bdc53dc193b9a4 (patch)
tree6d08d7b5077478a92acde6dd6e7278e98a409ce1 /toolkit
parent49a5e69f567302633299bf6626a9d9b9544ee94b (diff)
make comphelper::OInterfaceContainerHelper4 more threadsafe
(*) make all the methods that require an external mutex take a std::unique_lock as a parameter, so that call sites cannot forget (*) make the forEach method drop the lock when firing listener methods, to reduce the odds of deadlock Change-Id: I0a80e3b3d1c1c03b7de4a658d31fcc2847690903 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128415 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/controls/grid/gridcolumn.cxx7
-rw-r--r--toolkit/source/hatchwindow/documentcloser.cxx4
2 files changed, 5 insertions, 6 deletions
diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx
index 6d94ecb9a72b..0db9b50a5d75 100644
--- a/toolkit/source/controls/grid/gridcolumn.cxx
+++ b/toolkit/source/controls/grid/gridcolumn.cxx
@@ -81,8 +81,7 @@ namespace toolkit
i_oldValue, i_newValue, m_nIndex
);
- i_Guard.unlock();
- maGridColumnListeners.notifyEach( &XGridColumnListener::columnChanged, aEvent );
+ maGridColumnListeners.notifyEach( i_Guard, &XGridColumnListener::columnChanged, aEvent );
}
@@ -209,14 +208,14 @@ namespace toolkit
void SAL_CALL GridColumn::addGridColumnListener( const Reference< XGridColumnListener >& xListener )
{
std::unique_lock aGuard( m_aMutex );
- maGridColumnListeners.addInterface( xListener );
+ maGridColumnListeners.addInterface( aGuard, xListener );
}
void SAL_CALL GridColumn::removeGridColumnListener( const Reference< XGridColumnListener >& xListener )
{
std::unique_lock aGuard( m_aMutex );
- maGridColumnListeners.removeInterface( xListener );
+ maGridColumnListeners.removeInterface( aGuard, xListener );
}
diff --git a/toolkit/source/hatchwindow/documentcloser.cxx b/toolkit/source/hatchwindow/documentcloser.cxx
index 16df8536f5f1..2eceee0d9c4c 100644
--- a/toolkit/source/hatchwindow/documentcloser.cxx
+++ b/toolkit/source/hatchwindow/documentcloser.cxx
@@ -190,14 +190,14 @@ void SAL_CALL ODocumentCloser::addEventListener( const uno::Reference< lang::XEv
if ( m_bDisposed )
throw lang::DisposedException(); // TODO
- m_aListenersContainer.addInterface( xListener );
+ m_aListenersContainer.addInterface( aGuard, xListener );
}
void SAL_CALL ODocumentCloser::removeEventListener( const uno::Reference< lang::XEventListener >& xListener )
{
std::unique_lock aGuard( m_aMutex );
- m_aListenersContainer.removeInterface( xListener );
+ m_aListenersContainer.removeInterface( aGuard, xListener );
}
// XServiceInfo