mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
ValueTree: Add early exit when copying a ValueTree to itself
This commit is contained in:
parent
b51e835baf
commit
417bd3b342
1 changed files with 6 additions and 0 deletions
|
|
@ -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!
|
jassert (object != nullptr || source.object == nullptr); // Trying to add properties to a null ValueTree will fail!
|
||||||
|
|
||||||
|
if (source == *this)
|
||||||
|
return;
|
||||||
|
|
||||||
if (source.object == nullptr)
|
if (source.object == nullptr)
|
||||||
removeAllProperties (undoManager);
|
removeAllProperties (undoManager);
|
||||||
else if (object != nullptr)
|
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!
|
jassert (object != nullptr || source.object == nullptr); // Trying to copy to a null ValueTree will fail!
|
||||||
|
|
||||||
|
if (source == *this)
|
||||||
|
return;
|
||||||
|
|
||||||
copyPropertiesFrom (source, undoManager);
|
copyPropertiesFrom (source, undoManager);
|
||||||
removeAllChildren (undoManager);
|
removeAllChildren (undoManager);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue