Object: Make deleted object access raise errors, not warnings

Clarify doc about not decaying to `null` for `free` and `queue_free`.

Part of #45639.
This commit is contained in:
Rémi Verschelde
2021-04-20 11:33:26 +02:00
parent bb10729c6e
commit 1c9203ad68
5 changed files with 15 additions and 13 deletions

View File

@@ -201,7 +201,8 @@
<return type="void">
</return>
<description>
Deletes the object from memory. Any pre-existing reference to the freed object will become invalid, e.g. [code]is_instance_valid(object)[/code] will return [code]false[/code].
Deletes the object from memory immediately. For [Node]s, you may want to use [method Node.queue_free] to queue the node for safe deletion at the end of the current frame.
[b]Important:[/b] If you have a variable pointing to an object, it will [i]not[/i] be assigned to [code]null[/code] once the object is freed. Instead, it will point to a [i]previously freed instance[/i] and you should validate it with [method @GDScript.is_instance_valid] before attempting to call its methods or access its properties.
</description>
</method>
<method name="get" qualifiers="const">