Merge pull request #88 from Zylann/fix_ref_return_leak

Fix Ref leak when using Godot getters
This commit is contained in:
Thomas Herzog
2018-01-26 10:36:58 +01:00
committed by GitHub
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;
}
};
}