1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

GDScript: Cancel suspended functions when reloading a script

This commit is contained in:
HolonProduction
2025-02-07 10:32:05 +01:00
parent 134da37497
commit 676e4c9013
7 changed files with 51 additions and 15 deletions

View File

@@ -0,0 +1,12 @@
# TODO: This test is currently disabled since it triggers some complex memory leaks. Try enabling it again once GH-101830 is fixed.
signal finished
const scr: GDScript = preload("reload_suspended_function_helper.notest.gd")
func test():
@warning_ignore("UNSAFE_METHOD_ACCESS")
scr.test(self)
@warning_ignore("RETURN_VALUE_DISCARDED")
scr.reload(true)
finished.emit()

View File

@@ -0,0 +1,2 @@
GDTEST_RUNTIME_ERROR
>> WARNING: Canceling suspended execution of "test" due to a script reload.

View File

@@ -0,0 +1,3 @@
static func test(a):
await a.finished
pass