diff --git a/modules/juce_core/containers/juce_ListenerList.cpp b/modules/juce_core/containers/juce_ListenerList.cpp index 84b00adbd3..983b301180 100644 --- a/modules/juce_core/containers/juce_ListenerList.cpp +++ b/modules/juce_core/containers/juce_ListenerList.cpp @@ -110,7 +110,7 @@ public: } template - void callExcludingHelper (ListenerBase& listenerToExclude, + void callExcludingHelper (ListenerBase* listenerToExclude, std::vector& expectedCounterValues) { counter = 0; @@ -125,7 +125,7 @@ public: } template - void callExcludingHelper (ListenerBase& listenerToExclude, + void callExcludingHelper (ListenerBase* listenerToExclude, std::vector& expectedCounterValues, T first, Args... args) { const int expected = expectedCounterValues[sizeof... (args) + 1]; @@ -165,7 +165,7 @@ public: for (int i = 1; i < 8; ++i) expectedCounterValues.push_back (i); - callExcludingHelper (listener2, expectedCounterValues, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr); + callExcludingHelper (&listener2, expectedCounterValues, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr); } int counter = 0; diff --git a/modules/juce_core/containers/juce_ListenerList.h b/modules/juce_core/containers/juce_ListenerList.h index f898d62605..36ca27e3c9 100644 --- a/modules/juce_core/containers/juce_ListenerList.h +++ b/modules/juce_core/containers/juce_ListenerList.h @@ -142,7 +142,7 @@ public: /** Calls a member function, with no parameters, on all but the specified listener in the list. This can be useful if the caller is also a listener and needs to exclude itself. */ - void callExcluding (ListenerClass& listenerToExclude, void (ListenerClass::*callbackFunction) ()) + void callExcluding (ListenerClass* listenerToExclude, void (ListenerClass::*callbackFunction) ()) { callCheckedExcluding (listenerToExclude, static_cast (DummyBailOutChecker()), callbackFunction); @@ -164,12 +164,12 @@ public: description for info about writing a bail-out checker. */ template - void callCheckedExcluding (ListenerClass& listenerToExclude, + void callCheckedExcluding (ListenerClass* listenerToExclude, const BailOutCheckerType& bailOutChecker, void (ListenerClass::*callbackFunction) ()) { for (Iterator iter (*this); iter.next (bailOutChecker);) - if (iter.getListener() != &listenerToExclude) + if (iter.getListener() != listenerToExclude) (iter.getListener()->*callbackFunction) (); } @@ -186,11 +186,11 @@ public: This can be useful if the caller is also a listener and needs to exclude itself. */ template - void callExcluding (ListenerClass& listenerToExclude, + void callExcluding (ListenerClass* listenerToExclude, void (ListenerClass::*callbackFunction) (P1), LL_PARAM(1)) { for (Iterator iter (*this); iter.next();) - if (iter.getListener() != &listenerToExclude) + if (iter.getListener() != listenerToExclude) (iter.getListener()->*callbackFunction) (param1); } @@ -211,13 +211,13 @@ public: exclude itself. See the class description for info about writing a bail-out checker. */ template - void callCheckedExcluding (ListenerClass& listenerToExclude, + void callCheckedExcluding (ListenerClass* listenerToExclude, const BailOutCheckerType& bailOutChecker, void (ListenerClass::*callbackFunction) (P1), LL_PARAM(1)) { for (Iterator iter (*this); iter.next (bailOutChecker);) - if (iter.getListener() != &listenerToExclude) + if (iter.getListener() != listenerToExclude) (iter.getListener()->*callbackFunction) (param1); } @@ -235,12 +235,12 @@ public: This can be useful if the caller is also a listener and needs to exclude itself. */ template - void callExcluding (ListenerClass& listenerToExclude, + void callExcluding (ListenerClass* listenerToExclude, void (ListenerClass::*callbackFunction) (P1, P2), LL_PARAM(1), LL_PARAM(2)) { for (Iterator iter (*this); iter.next();) - if (iter.getListener() != &listenerToExclude) + if (iter.getListener() != listenerToExclude) (iter.getListener()->*callbackFunction) (param1, param2); } @@ -261,13 +261,13 @@ public: exclude itself. See the class description for info about writing a bail-out checker. */ template - void callCheckedExcluding (ListenerClass& listenerToExclude, + void callCheckedExcluding (ListenerClass* listenerToExclude, const BailOutCheckerType& bailOutChecker, void (ListenerClass::*callbackFunction) (P1, P2), LL_PARAM(1), LL_PARAM(2)) { for (Iterator iter (*this); iter.next (bailOutChecker);) - if (iter.getListener() != &listenerToExclude) + if (iter.getListener() != listenerToExclude) (iter.getListener()->*callbackFunction) (param1, param2); } @@ -285,12 +285,12 @@ public: This can be useful if the caller is also a listener and needs to exclude itself. */ template - void callExcluding (ListenerClass& listenerToExclude, + void callExcluding (ListenerClass* listenerToExclude, void (ListenerClass::*callbackFunction) (P1, P2, P3), LL_PARAM(1), LL_PARAM(2), LL_PARAM(3)) { for (Iterator iter (*this); iter.next();) - if (iter.getListener() != &listenerToExclude) + if (iter.getListener() != listenerToExclude) (iter.getListener()->*callbackFunction) (param1, param2, param3); } @@ -311,13 +311,13 @@ public: exclude itself. See the class description for info about writing a bail-out checker. */ template - void callCheckedExcluding (ListenerClass& listenerToExclude, + void callCheckedExcluding (ListenerClass* listenerToExclude, const BailOutCheckerType& bailOutChecker, void (ListenerClass::*callbackFunction) (P1, P2, P3), LL_PARAM(1), LL_PARAM(2), LL_PARAM(3)) { for (Iterator iter (*this); iter.next (bailOutChecker);) - if (iter.getListener() != &listenerToExclude) + if (iter.getListener() != listenerToExclude) (iter.getListener()->*callbackFunction) (param1, param2, param3); } @@ -335,12 +335,12 @@ public: This can be useful if the caller is also a listener and needs to exclude itself. */ template - void callExcluding (ListenerClass& listenerToExclude, + void callExcluding (ListenerClass* listenerToExclude, void (ListenerClass::*callbackFunction) (P1, P2, P3, P4), LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4)) { for (Iterator iter (*this); iter.next();) - if (iter.getListener() != &listenerToExclude) + if (iter.getListener() != listenerToExclude) (iter.getListener()->*callbackFunction) (param1, param2, param3, param4); } @@ -361,13 +361,13 @@ public: exclude itself. See the class description for info about writing a bail-out checker. */ template - void callCheckedExcluding (ListenerClass& listenerToExclude, + void callCheckedExcluding (ListenerClass* listenerToExclude, const BailOutCheckerType& bailOutChecker, void (ListenerClass::*callbackFunction) (P1, P2, P3, P4), LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4)) { for (Iterator iter (*this); iter.next (bailOutChecker);) - if (iter.getListener() != &listenerToExclude) + if (iter.getListener() != listenerToExclude) (iter.getListener()->*callbackFunction) (param1, param2, param3, param4); } @@ -385,12 +385,12 @@ public: This can be useful if the caller is also a listener and needs to exclude itself. */ template - void callExcluding (ListenerClass& listenerToExclude, + void callExcluding (ListenerClass* listenerToExclude, void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5), LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5)) { for (Iterator iter (*this); iter.next();) - if (iter.getListener() != &listenerToExclude) + if (iter.getListener() != listenerToExclude) (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5); } @@ -411,13 +411,13 @@ public: exclude itself. See the class description for info about writing a bail-out checker. */ template - void callCheckedExcluding (ListenerClass& listenerToExclude, + void callCheckedExcluding (ListenerClass* listenerToExclude, const BailOutCheckerType& bailOutChecker, void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5), LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5)) { for (Iterator iter (*this); iter.next (bailOutChecker);) - if (iter.getListener() != &listenerToExclude) + if (iter.getListener() != listenerToExclude) (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5); } @@ -435,12 +435,12 @@ public: This can be useful if the caller is also a listener and needs to exclude itself. */ template - void callExcluding (ListenerClass& listenerToExclude, + void callExcluding (ListenerClass* listenerToExclude, void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5, P6), LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5), LL_PARAM(6)) { for (Iterator iter (*this); iter.next();) - if (iter.getListener() != &listenerToExclude) + if (iter.getListener() != listenerToExclude) (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5, param6); } @@ -461,13 +461,13 @@ public: exclude itself. See the class description for info about writing a bail-out checker. */ template - void callCheckedExcluding (ListenerClass& listenerToExclude, + void callCheckedExcluding (ListenerClass* listenerToExclude, const BailOutCheckerType& bailOutChecker, void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5, P6), LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5), LL_PARAM(6)) { for (Iterator iter (*this); iter.next (bailOutChecker);) - if (iter.getListener() != &listenerToExclude) + if (iter.getListener() != listenerToExclude) (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5, param6); } diff --git a/modules/juce_data_structures/values/juce_ValueTree.cpp b/modules/juce_data_structures/values/juce_ValueTree.cpp index aca8cbff1d..525101871d 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.cpp +++ b/modules/juce_data_structures/values/juce_ValueTree.cpp @@ -96,10 +96,7 @@ public: { ValueTree tree (this); - if (listenerToExclude == nullptr) - callListenersForAllParents ([&] (ListenerList& list) { list.call (&ValueTree::Listener::valueTreePropertyChanged, tree, property); }); - else - callListenersForAllParents ([&] (ListenerList& list) { list.callExcluding (*listenerToExclude, &ValueTree::Listener::valueTreePropertyChanged, tree, property); }); + callListenersForAllParents ([&] (ListenerList& list) { list.callExcluding (listenerToExclude, &ValueTree::Listener::valueTreePropertyChanged, tree, property); }); } void sendChildAddedMessage (ValueTree child)