remove freed decks from container dicts on exit cleanup

This commit is contained in:
Lera Elvoé 2024-06-14 17:13:26 +03:00
parent f760cd227d
commit d4d17be574
No known key found for this signature in database

View file

@ -272,25 +272,27 @@ static func close_deck(deck_id: String) -> Array:
static func pre_exit_cleanup() -> void:
for deck_id: String in decks:
for deck_id: String in decks.keys():
if decks[deck_id] is Deck:
var deck: Deck = decks[deck_id]
print_verbose("DeckHolder: freeing deck %s, id %s" % [deck.id, deck.get_instance_id()])
deck.pre_exit_cleanup()
deck.free()
else:
for instance_id: String in decks[deck_id]:
for instance_id: String in (decks[deck_id] as Dictionary).keys():
var deck: Deck = decks[deck_id][instance_id]
print_verbose("DeckHolder: freeing group %s::%s, id %s" % [deck_id, instance_id, deck.get_instance_id()])
deck.pre_exit_cleanup()
deck.free()
decks.erase(deck_id)
for lib_id: String in lib_groups:
for lib_id: String in lib_groups.keys():
for instance_id: String in lib_groups[lib_id]:
var deck: Deck = lib_groups[lib_id][instance_id]
print_verbose("DeckHolder: freeing lib group %s::%s, id %s" % [lib_id, instance_id, deck.get_instance_id()])
deck.pre_exit_cleanup()
deck.free()
lib_groups.erase(lib_id)
static func send_event(event_name: StringName, event_data: Dictionary = {}) -> void: