From fc986c2d12a45f015372422bcb05fdb2935baa3d Mon Sep 17 00:00:00 2001 From: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Date: Tue, 5 Mar 2024 15:30:59 +0100 Subject: [PATCH] Fix crash on virtual method calls --- binding_generator.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/binding_generator.py b/binding_generator.py index cd2a86e1..dbeb809b 100644 --- a/binding_generator.py +++ b/binding_generator.py @@ -78,7 +78,8 @@ def generate_virtual_version(argcount, const=False, returns=False): if (::godot::internal::gdextension_interface_object_has_script_method(_owner, &_gdvirtual_##m_name##_sn)) { \\ GDExtensionCallError ce;\\ $CALLSIARGS\\ - $CALLSIBEGIN::godot::internal::gdextension_interface_object_call_script_method(_owner, &_gdvirtual_##m_name##_sn, $CALLSIARGPASS, $CALLSIRETPASS, &ce);\\ + Variant ret;\\ + ::godot::internal::gdextension_interface_object_call_script_method(_owner, &_gdvirtual_##m_name##_sn, $CALLSIARGPASS, &ret, &ce);\\ if (ce.error == GDEXTENSION_CALL_OK) {\\ $CALLSIRET\\ return true;\\ @@ -160,12 +161,8 @@ def generate_virtual_version(argcount, const=False, returns=False): if argcount > 0: callargtext += ", " callargtext += "m_ret &r_ret" - s = s.replace("$CALLSIBEGIN", "Variant ret;\\\n\t\t\t") - s = s.replace("$CALLSIRETPASS", "&ret") s = s.replace("$CALLSIRET", "r_ret = VariantCaster::cast(ret);") else: - s = s.replace("$CALLSIBEGIN", "") - s = s.replace("$CALLSIRETPASS", "nullptr") s = s.replace("\t\t\t\t$CALLSIRET\\\n", "") s = s.replace(" $ARG", argtext)