mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
close dangling group instances when the last group containing them is closed
This commit is contained in:
parent
0027ca5d1a
commit
a421535f11
1 changed files with 7 additions and 0 deletions
|
@ -92,9 +92,16 @@ static func get_group_instance(group_id: String, instance_id: String) -> Deck:
|
||||||
|
|
||||||
|
|
||||||
static func close_group_instance(group_id: String, instance_id: String) -> void:
|
static func close_group_instance(group_id: String, instance_id: String) -> void:
|
||||||
|
# this is kinda dumb, but to close groups that may be dangling
|
||||||
|
# when all instances are closed, we have to get that list
|
||||||
|
# *before* we close the instance
|
||||||
|
var dangling_groups := get_deck(group_id).get_referenced_groups()
|
||||||
|
|
||||||
var group_instances: Dictionary = decks.get(group_id, {}) as Dictionary
|
var group_instances: Dictionary = decks.get(group_id, {}) as Dictionary
|
||||||
group_instances.erase(instance_id)
|
group_instances.erase(instance_id)
|
||||||
if group_instances.is_empty():
|
if group_instances.is_empty():
|
||||||
|
for group in dangling_groups:
|
||||||
|
close_all_group_instances(group)
|
||||||
decks.erase(group_id)
|
decks.erase(group_id)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue