summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests
diff options
context:
space:
mode:
authorGeorge Marques <george@gmarqu.es>2023-04-26 10:57:22 -0300
committerRĂ©mi Verschelde <rverschelde@gmail.com>2023-04-27 08:49:29 +0200
commit21bb5b9c0e9a411e0210ce0e76529963e616a0c4 (patch)
tree2f6475be99301cf4491ea6fefcac63381dd28ac6 /modules/gdscript/tests
parentaff0340486d77ad0ce0325cc1c673386a073d265 (diff)
GDScript: Don't fail when freed object is return
This is check is a bit too eager. The user should be able to handle the return value even if it's a freed object. (cherry picked from commit abbdf806435aad401f2a7b6ce09838c8e4d5cbcb)
Diffstat (limited to 'modules/gdscript/tests')
-rw-r--r--modules/gdscript/tests/scripts/runtime/features/getter_with_freed_object.gd15
-rw-r--r--modules/gdscript/tests/scripts/runtime/features/getter_with_freed_object.out2
2 files changed, 17 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/runtime/features/getter_with_freed_object.gd b/modules/gdscript/tests/scripts/runtime/features/getter_with_freed_object.gd
new file mode 100644
index 0000000000..a2d09bf7d3
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/features/getter_with_freed_object.gd
@@ -0,0 +1,15 @@
+# https://github.com/godotengine/godot/issues/68184
+
+var node: Node:
+ get:
+ return node
+ set(n):
+ node = n
+
+
+func test():
+ node = Node.new()
+ node.free()
+
+ if !is_instance_valid(node):
+ print("It is freed")
diff --git a/modules/gdscript/tests/scripts/runtime/features/getter_with_freed_object.out b/modules/gdscript/tests/scripts/runtime/features/getter_with_freed_object.out
new file mode 100644
index 0000000000..b380f593d9
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/features/getter_with_freed_object.out
@@ -0,0 +1,2 @@
+GDTEST_OK
+It is freed