Fix calling of native functions that return object types

pull/602/head
George Marques 2021-09-08 15:07:23 -03:00 committed by Bastiaan Olij
parent 46c63af715
commit f5858ef6c6
2 changed files with 4 additions and 4 deletions

View File

@ -1056,7 +1056,7 @@ def generate_engine_class_source(class_api, used_classes, fully_used_classes, us
method_call += f"return Ref<{return_type}>::___internal_constructor(internal::_call_native_mb_ret_obj<{return_type}>(___method_bind, _owner"
is_ref = True
else:
method_call += f"return ({correct_type(return_type)})internal::_call_native_mb_ret_obj<{return_type}>(___method_bind, _owner"
method_call += f"return internal::_call_native_mb_ret_obj<{return_type}>(___method_bind, _owner"
else:
method_call += f"internal::_call_native_mb_no_ret(___method_bind, _owner"

View File

@ -44,11 +44,11 @@ namespace godot {
namespace internal {
template <class O, class... Args>
Object *_call_native_mb_ret_obj(const GDNativeMethodBindPtr mb, void *instance, const Args &...args) {
O *_call_native_mb_ret_obj(const GDNativeMethodBindPtr mb, void *instance, const Args &...args) {
GodotObject *ret = nullptr;
std::array<const GDNativeTypePtr, sizeof...(Args)> mb_args = { { (const GDNativeTypePtr)args... } };
internal::interface->object_method_bind_ptrcall(mb, instance, mb_args.data(), &ret);
return (Object *)internal::interface->object_get_instance_binding(ret, internal::token, &O::___binding_callbacks);
return reinterpret_cast<O *>(internal::interface->object_get_instance_binding(ret, internal::token, &O::___binding_callbacks));
}
template <class R, class... Args>