Skip to content

Commit

Permalink
Merge pull request #91153 from dsnopek/fix-gdextension-static-ptrcall
Browse files Browse the repository at this point in the history
Fix ptrcalls to static GDExtension methods
  • Loading branch information
akien-mga committed Apr 25, 2024
2 parents e399f86 + 45463f7 commit 11d3768
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/extension/gdextension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ class GDExtensionMethodBind : public MethodBind {
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);
Expand All @@ -289,7 +289,7 @@ class GDExtensionMethodBind : public MethodBind {
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);
}

Expand Down

0 comments on commit 11d3768

Please sign in to comment.