diff --git a/modules/juce_data_structures/values/juce_ValueTree.cpp b/modules/juce_data_structures/values/juce_ValueTree.cpp index f776224986..d46ebfe3ad 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.cpp +++ b/modules/juce_data_structures/values/juce_ValueTree.cpp @@ -789,6 +789,11 @@ void ValueTree::copyPropertiesFrom (const ValueTree& source, UndoManager* const object->copyPropertiesFrom (*(source.object), undoManager); } +int ValueTree::getReferenceCount() const noexcept +{ + return object != nullptr ? object->getReferenceCount() : 0; +} + //============================================================================== class ValueTreePropertyValueSource : public Value::ValueSource, private ValueTree::Listener diff --git a/modules/juce_data_structures/values/juce_ValueTree.h b/modules/juce_data_structures/values/juce_ValueTree.h index 311d722f31..1e37e0cfd3 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.h +++ b/modules/juce_data_structures/values/juce_ValueTree.h @@ -490,6 +490,11 @@ public: */ static const ValueTree invalid; + /** Returns the total number of references to the shared underlying data structure that this + ValueTree is using. + */ + int getReferenceCount() const noexcept; + private: //============================================================================== JUCE_PUBLIC_IN_DLL_BUILD (class SharedObject)