Merge pull request #91153 from dsnopek/fix-gdextension-static-ptrcall

Fix ptrcalls to static GDExtension methods
This commit is contained in:
Rémi Verschelde 2024-04-25 17:12:47 +02:00
commit 11d3768132
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 2 additions and 2 deletions

View File

@ -275,7 +275,7 @@ public:
ret_opaque = r_ret->get_type() == Variant::NIL ? r_ret : VariantInternal::get_opaque_pointer(r_ret);
}
ptrcall(p_object, argptrs, ret_opaque);
ptrcall_func(method_userdata, extension_instance, reinterpret_cast<GDExtensionConstTypePtr *>(argptrs), (GDExtensionTypePtr)ret_opaque);
if (r_ret && r_ret->get_type() == Variant::OBJECT) {
VariantInternal::update_object_id(r_ret);
@ -289,7 +289,7 @@ public:
ERR_FAIL_COND_MSG(p_object && p_object->is_extension_placeholder(), vformat("Cannot call GDExtension method bind '%s' on placeholder instance.", name));
#endif
ERR_FAIL_COND_MSG(vararg, "Vararg methods don't have ptrcall support. This is most likely an engine bug.");
GDExtensionClassInstancePtr extension_instance = p_object->_get_extension_instance();
GDExtensionClassInstancePtr extension_instance = is_static() ? nullptr : p_object->_get_extension_instance();
ptrcall_func(method_userdata, extension_instance, reinterpret_cast<GDExtensionConstTypePtr *>(p_args), (GDExtensionTypePtr)r_ret);
}