mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-31 03:00:05 +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
|
|
@ -83,6 +83,9 @@ public:
|
|||
|
||||
var getValue() const override
|
||||
{
|
||||
if (valueWithDefault == nullptr)
|
||||
return {};
|
||||
|
||||
if (valueWithDefault->isUsingDefault())
|
||||
return -1;
|
||||
|
||||
|
|
@ -97,6 +100,9 @@ public:
|
|||
|
||||
void setValue (const var& newValue) override
|
||||
{
|
||||
if (valueWithDefault == nullptr)
|
||||
return;
|
||||
|
||||
auto newValueInt = static_cast<int> (newValue);
|
||||
|
||||
if (newValueInt == -1)
|
||||
|
|
@ -115,7 +121,7 @@ public:
|
|||
private:
|
||||
void valueChanged (Value&) override { sendChangeMessage (true); }
|
||||
|
||||
ValueWithDefault* valueWithDefault = nullptr;
|
||||
WeakReference<ValueWithDefault> valueWithDefault;
|
||||
Value sourceValue;
|
||||
Array<var> mappings;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue