1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +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 b592be8e81
commit 35890478a3
7 changed files with 38 additions and 11 deletions

View file

@ -181,6 +181,15 @@ public:
/** Returns the property ID of the referenced property. */
Identifier& getPropertyID() noexcept { return targetProperty; }
//==============================================================================
ValueWithDefault& operator= (const ValueWithDefault& other)
{
referToWithDefault (other.targetTree, other.targetProperty, other.undoManager,
other.defaultValue, other.delimiter);
return *this;
}
private:
//==============================================================================
ValueTree targetTree;
@ -191,7 +200,7 @@ private:
String delimiter;
//==============================================================================
void referToWithDefault (ValueTree& v, const Identifier& i, UndoManager* um,
void referToWithDefault (const ValueTree& v, const Identifier& i, UndoManager* um,
const var& defaultVal, StringRef del)
{
targetTree = v;
@ -225,6 +234,9 @@ private:
return arr;
}
//==============================================================================
JUCE_DECLARE_WEAK_REFERENCEABLE (ValueWithDefault)
};
} // namespace juce