summaryrefslogtreecommitdiff
path: root/include/comphelper
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-01-18 11:03:55 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-01-18 15:04:18 +0100
commita605f2f8fd3e848ed1229328144f948adea82256 (patch)
tree5233ff88c51aa74be16b1d0ecf19dee8b6e2dab7 /include/comphelper
parent1103240cb3e884ea6024a690eeed743934662a12 (diff)
fix locking in comphelper::OInterfaceContainerHelper4::forEach
regression from commit a2eaf99e46f370ffb3b73828c2bdc53dc193b9a4 Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Fri Jan 14 10:56:50 2022 +0200 make comphelper::OInterfaceContainerHelper4 more threadsafe Change-Id: Iea42fd0bba6da99d82076b4d1b495d67fa62243c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128526 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/comphelper')
-rw-r--r--include/comphelper/interfacecontainer4.hxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/comphelper/interfacecontainer4.hxx b/include/comphelper/interfacecontainer4.hxx
index b8e2079a9201..1df8f47776eb 100644
--- a/include/comphelper/interfacecontainer4.hxx
+++ b/include/comphelper/interfacecontainer4.hxx
@@ -271,7 +271,10 @@ inline void OInterfaceContainerHelper4<T>::forEach(std::unique_lock<std::mutex>&
FuncT const& func)
{
if (std::as_const(maData)->size() == 0)
+ {
+ rGuard.unlock(); // code depends on the guard being unlocked after return
return;
+ }
maData.make_unique(); // so we can iterate over the data without holding the lock
OInterfaceIteratorHelper4<T> iter(rGuard, *this);
rGuard.unlock();