mirror of
https://github.com/godotengine/godot.git
synced 2025-01-24 21:01:50 +08:00
GDScript Don't double-reference Refs returned from native function
This commit is contained in:
parent
73668c59aa
commit
6141ce2cb8
@ -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:
|
||||
|
@ -1814,7 +1814,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::object_assign(ret, *ret_opaque); // Set so ID is correct too.
|
||||
VariantInternal::update_object_id(ret);
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (GDScriptLanguage::get_singleton()->profiling) {
|
||||
|
Loading…
Reference in New Issue
Block a user