mirror of
https://github.com/godotengine/godot.git
synced 2025-10-26 03:04:31 +00:00
Promote object validity checks to release builds
Extra: - Optimized the debug-only check about why the object is null to determine if it's because it has been deleted (the RC is enough; no need to check the ObjectDB). - Because of the previous point. the debugger being attached is not required anymore for giving the "Object was deleted" error; from now, it only matters that it's a debug build. - `is_instance_valid()` is now trustworthy. It will return `true` if, and only if, the last object assigned to a `Variant` is still alive (and not if a new object happened to be created at the same memory address of the old one). - Replacements of `instance_validate()` are used where possible `Variant::is_invalid_object()` is introduced to help with that. (GDScript's `is_instance_valid()` is good.)
This commit is contained in:
parent
1bbc7c9c3a
commit
26edc6cd41
13 changed files with 71 additions and 152 deletions
|
|
@ -1382,7 +1382,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
|
|||
r_ret = false;
|
||||
} else {
|
||||
Object *obj = *p_args[0];
|
||||
r_ret = ObjectDB::instance_validate(obj);
|
||||
r_ret = obj != nullptr;
|
||||
}
|
||||
|
||||
} break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue