From 29cb346db299fe7e9b4c2b05ecdaaaabc32d9791 Mon Sep 17 00:00:00 2001 From: Anthony Nicholls Date: Thu, 13 Jun 2024 11:22:04 +0100 Subject: [PATCH] ListenerList: Prevent a data race while clearing the list --- modules/juce_core/containers/juce_ListenerList.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/juce_core/containers/juce_ListenerList.h b/modules/juce_core/containers/juce_ListenerList.h index bdfd476d9b..ee8ec18041 100644 --- a/modules/juce_core/containers/juce_ListenerList.h +++ b/modules/juce_core/containers/juce_ListenerList.h @@ -171,6 +171,8 @@ public: if (! initialised()) return; + const ScopedLockType lock { listeners->getLock() }; + listeners->clear(); for (auto* it : *iterators)