diff options
author | George Marques <george@gmarqu.es> | 2020-11-30 14:27:44 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2020-11-30 14:49:52 -0300 |
commit | 029fd88adbc95e32d8613d315fa81fa978ca04c3 (patch) | |
tree | f332ce311172bce3bb28bb9aa4d9676f97b010ef /modules/gdscript | |
parent | b9a2787bd164602e866ecac1527020e0e1c34da8 (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.cpp | 2 |
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) { |