From b365a634038d4a60f31b22b58be5e4667a8663dc Mon Sep 17 00:00:00 2001 From: kobewi Date: Thu, 23 May 2024 17:10:55 +0200 Subject: Automatically use property count in PropertyListHelper --- scene/property_list_helper.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'scene/property_list_helper.cpp') diff --git a/scene/property_list_helper.cpp b/scene/property_list_helper.cpp index 152ecaf89d..ce258ee8c3 100644 --- a/scene/property_list_helper.cpp +++ b/scene/property_list_helper.cpp @@ -122,8 +122,9 @@ bool PropertyListHelper::is_property_valid(const String &p_property, int *r_inde return property_list.has(components[1]); } -void PropertyListHelper::get_property_list(List *p_list, int p_count) const { - for (int i = 0; i < p_count; i++) { +void PropertyListHelper::get_property_list(List *p_list) const { + const int property_count = _call_array_length_getter(); + for (int i = 0; i < property_count; i++) { for (const KeyValue &E : property_list) { const Property &property = E.value; @@ -177,7 +178,9 @@ bool PropertyListHelper::property_get_revert(const String &p_property, Variant & PropertyListHelper::~PropertyListHelper() { // No object = it's the main helper. Do a cleanup. - if (!object) { + if (!object && is_initialized()) { + memdelete(array_length_getter); + for (const KeyValue &E : property_list) { if (E.value.setter) { memdelete(E.value.setter); -- cgit v1.2.3