From 029fd88adbc95e32d8613d315fa81fa978ca04c3 Mon Sep 17 00:00:00 2001 From: George Marques Date: Mon, 30 Nov 2020 14:27:44 -0300 Subject: 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. --- modules/gdscript/gdscript_vm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gdscript') diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp index 7c8bfcd944..7942ee8d97 100644 --- a/modules/gdscript/gdscript_vm.cpp +++ b/modules/gdscript/gdscript_vm.cpp @@ -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) { -- cgit v1.2.3