diff --git a/classes/deck/deck_holder.gd b/classes/deck/deck_holder.gd index c1210cb..6b32cd2 100644 --- a/classes/deck/deck_holder.gd +++ b/classes/deck/deck_holder.gd @@ -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: