mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Fix VariantInternal initialization and setting of object
- Initialize Object pointer to nullptr so it's not used by mistake. - When setting an Object check if it's a reference so refcounting works as intended.
This commit is contained in:
parent
b9a2787bd1
commit
029fd88adb
3 changed files with 24 additions and 22 deletions
|
@ -1653,7 +1653,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
VariantInternal::initialize(ret, Variant::OBJECT);
|
||||
Object **ret_opaque = VariantInternal::get_object(ret);
|
||||
method->ptrcall(base_obj, argptrs, ret_opaque);
|
||||
VariantInternal::set_object(ret, *ret_opaque);
|
||||
VariantInternal::object_assign(ret, *ret_opaque); // Set so ID is correct too.
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (GDScriptLanguage::get_singleton()->profiling) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue