Fix Ref leak when using Godot getters

This commit is contained in:
Marc Gilleron
2018-01-24 23:16:00 +01:00
parent 9ed6edaae1
commit ac0679eb1a
2 changed files with 11 additions and 2 deletions

View File

@@ -199,6 +199,15 @@ public:
unref();
}
// Used exclusively in the bindings to recreate the Ref Godot encapsulates in return values,
// without adding to the refcount.
inline static Ref<T> __internal_constructor(Object *obj)
{
Ref<T> r;
r.reference = (T*)obj;
return r;
}
};
}