summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorBrian Semrau <brian.semrau@gmail.com>2021-09-27 12:23:57 -0400
committerBrian Semrau <brian.semrau@gmail.com>2021-09-28 12:40:23 -0400
commit6141ce2cb8ae54965190257a1ffd6a6abd02aaea (patch)
tree493015dd583d9ff88b2d40ad0b1334f2ba142f3f /core
parent73668c59aab8ad16535868f56f603d17808a575b (diff)
GDScript Don't double-reference Refs returned from native function
Diffstat (limited to 'core')
-rw-r--r--core/variant/variant_internal.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/variant/variant_internal.h b/core/variant/variant_internal.h
index 40c8a1bfde..ad095c27e7 100644
--- a/core/variant/variant_internal.h
+++ b/core/variant/variant_internal.h
@@ -300,6 +300,13 @@ public:
v->_get_obj().id = ObjectID();
}
+ static void update_object_id(Variant *v) {
+ const Object *o = v->_get_obj().obj;
+ if (o) {
+ v->_get_obj().id = o->get_instance_id();
+ }
+ }
+
_FORCE_INLINE_ static void *get_opaque_pointer(Variant *v) {
switch (v->type) {
case Variant::NIL: