Fix logger _schedule() logic

This commit is contained in:
JeremyStar™ 2024-05-10 19:15:56 +02:00
parent d62467bd05
commit fd4d7d2eb0
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -52,13 +52,15 @@ func _cleanup() -> void:
func _schedule() -> void: func _schedule() -> void:
var instances_remove_enty: Array[CoreLoggerInstance] = [] var instances_remove_enty: Array[CoreLoggerInstance] = []
for instance in instances: for instance in instances:
instances_remove_enty.append(instance)
if !is_instance_valid(instance): continue if !is_instance_valid(instance): continue
if !is_instance_valid(instance.parent): if !is_instance_valid(instance.parent):
logger.diag("Removing instance '" + instance.name + "'") logger.diag("Removing instance '" + instance.name + "'")
instance.queue_free() instance.queue_free()
instances_remove_enty.append(instance)
for instance in instances_remove_enty: for instance in instances_remove_enty:
instances.remove_at(instances.find(instance)) var index: int = instances.find(instance)
if index == -1: logger.error("Invalid index -1")
else: instances.remove_at(index)
func _pull_config() -> void: func _pull_config() -> void:
config_level = core.config.logger_level config_level = core.config.logger_level