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:
parent
e786f9c0aa
commit
717cc49382
7 changed files with 38 additions and 11 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue