1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

ValueTree: Add early exit when copying a ValueTree to itself

This commit is contained in:
Tom Poole 2022-08-02 10:14:29 +01:00
parent b51e835baf
commit 417bd3b342

View file

@ -669,6 +669,9 @@ void ValueTree::copyPropertiesFrom (const ValueTree& source, UndoManager* undoMa
{
jassert (object != nullptr || source.object == nullptr); // Trying to add properties to a null ValueTree will fail!
if (source == *this)
return;
if (source.object == nullptr)
removeAllProperties (undoManager);
else if (object != nullptr)
@ -679,6 +682,9 @@ void ValueTree::copyPropertiesAndChildrenFrom (const ValueTree& source, UndoMana
{
jassert (object != nullptr || source.object == nullptr); // Trying to copy to a null ValueTree will fail!
if (source == *this)
return;
copyPropertiesFrom (source, undoManager);
removeAllChildren (undoManager);