1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-24 01:54:22 +00:00

Added the JUCE_DECLARE_WEAK_REFERENCEABLE macro to ValueWithDefault and fixed some places which were potentially accessing a deleted ValueWithDefault object

This commit is contained in:
ed 2018-11-16 15:53:29 +00:00
parent e786f9c0aa
commit 717cc49382
7 changed files with 38 additions and 11 deletions

View file

@ -118,6 +118,9 @@ public:
var getValue() const override
{
if (valueWithDefault == nullptr)
return {};
auto v = valueWithDefault->get();
if (auto* arr = v.getArray())
@ -134,6 +137,9 @@ public:
void setValue (const var& newValue) override
{
if (valueWithDefault == nullptr)
return;
auto v = valueWithDefault->get();
OptionalScopedPointer<Array<var>> arrayToControl;
@ -191,7 +197,7 @@ private:
}
//==============================================================================
ValueWithDefault* valueWithDefault = nullptr;
WeakReference<ValueWithDefault> valueWithDefault;
var varToControl;
Value sourceValue;