mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-28 02:30:05 +00:00
Adding missing locks in ListenerList when the underlying array of the ListenerList uses a CriticalSection
This commit is contained in:
parent
8ec069cabe
commit
89ec1375f3
1 changed files with 16 additions and 0 deletions
|
|
@ -118,6 +118,8 @@ public:
|
|||
template <typename Callback>
|
||||
void call (Callback&& callback)
|
||||
{
|
||||
typename ArrayType::ScopedLockType lock (listeners.getLock());
|
||||
|
||||
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();)
|
||||
callback (*iter.getListener());
|
||||
}
|
||||
|
|
@ -128,6 +130,8 @@ public:
|
|||
template <typename Callback>
|
||||
void callExcluding (ListenerClass* listenerToExclude, Callback&& callback)
|
||||
{
|
||||
typename ArrayType::ScopedLockType lock (listeners.getLock());
|
||||
|
||||
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();)
|
||||
{
|
||||
auto* l = iter.getListener();
|
||||
|
|
@ -143,6 +147,8 @@ public:
|
|||
template <typename Callback, typename BailOutCheckerType>
|
||||
void callChecked (const BailOutCheckerType& bailOutChecker, Callback&& callback)
|
||||
{
|
||||
typename ArrayType::ScopedLockType lock (listeners.getLock());
|
||||
|
||||
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
|
||||
callback (*iter.getListener());
|
||||
}
|
||||
|
|
@ -156,6 +162,8 @@ public:
|
|||
const BailOutCheckerType& bailOutChecker,
|
||||
Callback&& callback)
|
||||
{
|
||||
typename ArrayType::ScopedLockType lock (listeners.getLock());
|
||||
|
||||
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
|
||||
{
|
||||
auto* l = iter.getListener();
|
||||
|
|
@ -252,6 +260,8 @@ public:
|
|||
template <typename... MethodArgs, typename... Args>
|
||||
void call (void (ListenerClass::*callbackFunction) (MethodArgs...), Args&&... args)
|
||||
{
|
||||
typename ArrayType::ScopedLockType lock (listeners.getLock());
|
||||
|
||||
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();)
|
||||
(iter.getListener()->*callbackFunction) (static_cast<typename TypeHelpers::ParameterType<Args>::type> (args)...);
|
||||
}
|
||||
|
|
@ -261,6 +271,8 @@ public:
|
|||
void (ListenerClass::*callbackFunction) (MethodArgs...),
|
||||
Args&&... args)
|
||||
{
|
||||
typename ArrayType::ScopedLockType lock (listeners.getLock());
|
||||
|
||||
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();)
|
||||
if (iter.getListener() != listenerToExclude)
|
||||
(iter.getListener()->*callbackFunction) (static_cast<typename TypeHelpers::ParameterType<Args>::type> (args)...);
|
||||
|
|
@ -271,6 +283,8 @@ public:
|
|||
void (ListenerClass::*callbackFunction) (MethodArgs...),
|
||||
Args&&... args)
|
||||
{
|
||||
typename ArrayType::ScopedLockType lock (listeners.getLock());
|
||||
|
||||
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
|
||||
(iter.getListener()->*callbackFunction) (static_cast<typename TypeHelpers::ParameterType<Args>::type> (args)...);
|
||||
}
|
||||
|
|
@ -281,6 +295,8 @@ public:
|
|||
void (ListenerClass::*callbackFunction) (MethodArgs...),
|
||||
Args&&... args)
|
||||
{
|
||||
typename ArrayType::ScopedLockType lock (listeners.getLock());
|
||||
|
||||
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
|
||||
if (iter.getListener() != listenerToExclude)
|
||||
(iter.getListener()->*callbackFunction) (static_cast<typename TypeHelpers::ParameterType<Args>::type> (args)...);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue