GDScript: Fix interrupted coroutines not clearing

This commit is contained in:
Danil Alexeev 2026-02-24 12:04:29 +03:00
parent 8120fb1242
commit ba8b2a1ff0
No known key found for this signature in database
GPG key ID: 5A52F75A8679EC57
3 changed files with 42 additions and 0 deletions

View file

@ -0,0 +1,33 @@
# GH-116706
class Instance:
func _init() -> void:
print("Instance _init")
func _notification(what: int) -> void:
if what == NOTIFICATION_PREDELETE:
print("Instance predelete")
class LocalOwner:
signal never_emitted()
func _init() -> void:
print("LocalOwner _init")
func _notification(what: int) -> void:
if what == NOTIFICATION_PREDELETE:
print("LocalOwner predelete")
func interrupted_coroutine() -> void:
print("interrupted_coroutine begin")
var _instance := Instance.new()
await never_emitted
print("interrupted_coroutine end")
func test():
print("test begin")
var local_owner := LocalOwner.new()
@warning_ignore("missing_await")
local_owner.interrupted_coroutine()
local_owner = null
print("test end")

View file

@ -0,0 +1,8 @@
GDTEST_OK
test begin
LocalOwner _init
interrupted_coroutine begin
Instance _init
LocalOwner predelete
Instance predelete
test end