summaryrefslogtreecommitdiff
path: root/modules/gdscript
diff options
context:
space:
mode:
authorGeorge Marques <george@gmarqu.es>2020-11-30 14:27:44 -0300
committerGeorge Marques <george@gmarqu.es>2020-11-30 14:49:52 -0300
commit029fd88adbc95e32d8613d315fa81fa978ca04c3 (patch)
treef332ce311172bce3bb28bb9aa4d9676f97b010ef /modules/gdscript
parentb9a2787bd164602e866ecac1527020e0e1c34da8 (diff)
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.
Diffstat (limited to 'modules/gdscript')
-rw-r--r--modules/gdscript/gdscript_vm.cpp2
1 files changed, 1 insertions, 1 deletions
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) {