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

Merge pull request #102521 from HolonProduction/cancel-await

GDScript: Cancel suspended functions when reloading a script
This commit is contained in:
Thaddeus Crews
2025-04-08 12:32:52 -05:00
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