diff --git a/modules/juce_core/containers/juce_Array.h b/modules/juce_core/containers/juce_Array.h index 6228ea9c41..4e66a70eaa 100644 --- a/modules/juce_core/containers/juce_Array.h +++ b/modules/juce_core/containers/juce_Array.h @@ -207,10 +207,10 @@ public: /** Fills the Array with the provided value. */ void fill (const ParameterType& newValue) noexcept { - auto n = size(); + const ScopedLockType lock (getLock()); - for (int i = 0; i < n; ++i) - setUnchecked (i, newValue); + for (auto& e : *this) + e = newValue; } //==============================================================================