Fix cleanup issues
This commit is contained in:
parent
6dd45fb877
commit
143e2d3176
2 changed files with 11 additions and 5 deletions
|
@ -210,7 +210,7 @@ func unregister_custom_module(module_name: String) -> void:
|
||||||
if !custom_modules.has(module_name):
|
if !custom_modules.has(module_name):
|
||||||
loggeri.error("Unregistering module failed: A custom module with the name \"" + module_name + "\" does not exist.")
|
loggeri.error("Unregistering module failed: A custom module with the name \"" + module_name + "\" does not exist.")
|
||||||
return
|
return
|
||||||
var module: Node = get_custom_module(module_name)
|
var module: Node = custom_modules[module_name]
|
||||||
await module._cleanup()
|
await module._cleanup()
|
||||||
module.loggeri.queue_free()
|
module.loggeri.queue_free()
|
||||||
custom_modules_node.remove_child(module)
|
custom_modules_node.remove_child(module)
|
||||||
|
@ -231,7 +231,7 @@ func get_custom_module(module_name: String) -> CoreBaseModule:
|
||||||
## Unloads all custom modules, built-in modules, frees any of CORE's classes and lastly itself.
|
## Unloads all custom modules, built-in modules, frees any of CORE's classes and lastly itself.
|
||||||
func cleanup() -> void:
|
func cleanup() -> void:
|
||||||
loggeri.info("Cleaning up")
|
loggeri.info("Cleaning up")
|
||||||
for module in custom_modules_node.get_children(): unregister_custom_module(module.name)
|
for module in custom_modules_node.get_children(): await unregister_custom_module(module.name)
|
||||||
remove_child(custom_modules_node)
|
remove_child(custom_modules_node)
|
||||||
custom_modules_node.queue_free()
|
custom_modules_node.queue_free()
|
||||||
var modules_reverse: Array[String] = modules.duplicate()
|
var modules_reverse: Array[String] = modules.duplicate()
|
||||||
|
@ -241,6 +241,7 @@ func cleanup() -> void:
|
||||||
get(module).loggeri.queue_free()
|
get(module).loggeri.queue_free()
|
||||||
get(module).queue_free()
|
get(module).queue_free()
|
||||||
config.queue_free()
|
config.queue_free()
|
||||||
|
await get_tree().process_frame
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
||||||
## Returns if the framework is in development mode.
|
## Returns if the framework is in development mode.
|
||||||
|
|
|
@ -46,16 +46,21 @@ var config_newlines_sizelimit: int
|
||||||
|
|
||||||
# +++ module +++
|
# +++ module +++
|
||||||
func _cleanup() -> void:
|
func _cleanup() -> void:
|
||||||
_schedule()
|
for instance in instances:
|
||||||
await get_tree().process_frame
|
if !is_instance_valid(instance):
|
||||||
|
loggeri.diag("Removing instance '" + instance.name + "'")
|
||||||
|
instance.queue_free()
|
||||||
|
|
||||||
func _schedule() -> void:
|
func _schedule() -> void:
|
||||||
|
var instances_remove_enty: Array[CoreLoggerInstance] = []
|
||||||
for instance in instances:
|
for instance in instances:
|
||||||
if !is_instance_valid(instance): continue
|
if !is_instance_valid(instance): continue
|
||||||
if !is_instance_valid(instance.parent):
|
if !is_instance_valid(instance.parent):
|
||||||
loggeri.diag("Removing instance '" + instance.name + "'")
|
loggeri.diag("Removing instance '" + instance.name + "'")
|
||||||
instance.queue_free()
|
instance.queue_free()
|
||||||
instances.remove_at(instances.find(instance))
|
instances_remove_enty.append(instance)
|
||||||
|
for instance in instances_remove_enty:
|
||||||
|
instances.remove_at(instances.find(instance))
|
||||||
|
|
||||||
func _pull_config() -> void:
|
func _pull_config() -> void:
|
||||||
config_level = core.config.logger_level
|
config_level = core.config.logger_level
|
||||||
|
|
Loading…
Reference in a new issue