aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic-extension/classes/GUIListBox.cpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-07-26 22:59:12 +0200
committer hop311 <hop3114@gmail.com>2024-07-26 22:59:12 +0200
commit164db4eb8f24e87755e02bae0e539f4f266e15b9 (patch)
tree9ab24e79d47c2c56dfd68ebf89e419d30324c92c /extension/src/openvic-extension/classes/GUIListBox.cpp
parent46c3009075be36577ab7dbea263655e428833b20 (diff)
Free removed child nodes + `godot::` cleanupfree-on-remove
Diffstat (limited to 'extension/src/openvic-extension/classes/GUIListBox.cpp')
-rw-r--r--extension/src/openvic-extension/classes/GUIListBox.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/extension/src/openvic-extension/classes/GUIListBox.cpp b/extension/src/openvic-extension/classes/GUIListBox.cpp
index d04ab59..c153870 100644
--- a/extension/src/openvic-extension/classes/GUIListBox.cpp
+++ b/extension/src/openvic-extension/classes/GUIListBox.cpp
@@ -182,6 +182,7 @@ void GUIListBox::clear() {
clear_children();
if (scrollbar != nullptr) {
remove_child(scrollbar);
+ scrollbar->queue_free();
scrollbar = nullptr;
}
}
@@ -192,7 +193,9 @@ void GUIListBox::clear_children(int32_t remaining_child_count) {
int32_t child_index = get_child_count();
while (child_index > remaining_child_count) {
- remove_child(get_child(--child_index));
+ Node* child = get_child(--child_index);
+ remove_child(child);
+ child->queue_free();
}
if (scrollbar != nullptr) {