From 164db4eb8f24e87755e02bae0e539f4f266e15b9 Mon Sep 17 00:00:00 2001 From: hop311 Date: Fri, 26 Jul 2024 21:59:12 +0100 Subject: Free removed child nodes + `godot::` cleanup --- game/src/Game/GameSession/MapText.gd | 4 +++- game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'game/src/Game') diff --git a/game/src/Game/GameSession/MapText.gd b/game/src/Game/GameSession/MapText.gd index 22eba10..619c72f 100644 --- a/game/src/Game/GameSession/MapText.gd +++ b/game/src/Game/GameSession/MapText.gd @@ -14,7 +14,9 @@ func _clear_children() -> void: var child_count : int = get_child_count() while child_count > 0: child_count -= 1 - remove_child(get_child(child_count)) + var child : Node = get_child(child_count) + remove_child(child) + child.queue_free() func generate_map_names() -> void: _clear_children() diff --git a/game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd b/game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd index 2799dd4..ad15fbb 100644 --- a/game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd +++ b/game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd @@ -104,6 +104,7 @@ func _generate_province_list_row(index : int, type : MenuSingleton.ProvinceListE if _province_list_panels[index]: _province_listbox.remove_child(_province_list_panels[index]) + _province_list_panels[index].queue_free() _province_list_types[index] = MenuSingleton.LIST_ENTRY_NONE _province_list_indices[index] = -1 @@ -540,7 +541,7 @@ func _update_distributions(): child.set_mouse_filter(Control.MOUSE_FILTER_IGNORE) list.add_child(child) - for list_index in min(list.get_child_count(), distribution_info.size()): + for list_index : int in min(list.get_child_count(), distribution_info.size()): var child : Panel = list.get_child(list_index) -- cgit v1.2.3-56-ga3b1