diff options
Diffstat (limited to 'modules/gdscript')
3 files changed, 17 insertions, 4 deletions
diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp index 7098e4cd40..0855a670df 100644 --- a/modules/gdscript/gdscript_vm.cpp +++ b/modules/gdscript/gdscript_vm.cpp @@ -1651,10 +1651,6 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a bool was_freed = false; Object *obj = ret->get_validated_object_with_check(was_freed); - if (was_freed) { - err_text = "Got a freed object as a result of the call."; - OPCODE_BREAK; - } if (obj && obj->is_class_ptr(GDScriptFunctionState::get_class_ptr_static())) { err_text = R"(Trying to call an async function without "await".)"; OPCODE_BREAK; 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 |