diff options
Diffstat (limited to 'scene/property_list_helper.cpp')
-rw-r--r-- | scene/property_list_helper.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/scene/property_list_helper.cpp b/scene/property_list_helper.cpp index ce258ee8c3..f840aaa759 100644 --- a/scene/property_list_helper.cpp +++ b/scene/property_list_helper.cpp @@ -30,6 +30,19 @@ #include "property_list_helper.h" +Vector<PropertyListHelper *> PropertyListHelper::base_helpers; // static + +void PropertyListHelper::clear_base_helpers() { // static + for (PropertyListHelper *helper : base_helpers) { + helper->clear(); + } + base_helpers.clear(); +} + +void PropertyListHelper::register_base_helper(PropertyListHelper *p_helper) { // static + base_helpers.push_back(p_helper); +} + const PropertyListHelper::Property *PropertyListHelper::_get_property(const String &p_property, int *r_index) const { const Vector<String> components = p_property.rsplit("/", true, 1); if (components.size() < 2 || !components[0].begins_with(prefix)) { @@ -176,9 +189,8 @@ bool PropertyListHelper::property_get_revert(const String &p_property, Variant & return false; } -PropertyListHelper::~PropertyListHelper() { - // No object = it's the main helper. Do a cleanup. - if (!object && is_initialized()) { +void PropertyListHelper::clear() { + if (is_initialized()) { memdelete(array_length_getter); for (const KeyValue<String, Property> &E : property_list) { @@ -187,5 +199,6 @@ PropertyListHelper::~PropertyListHelper() { memdelete(E.value.getter); } } + property_list.clear(); } } |