You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 17:36:07 +00:00
Merge pull request #56409 from cdemirer/fix-unexpected-copying-when-parameter-is-typed
This commit is contained in:
@@ -488,7 +488,12 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||||||
memnew_placement(&stack[i + 3], Variant(*p_args[i]));
|
memnew_placement(&stack[i + 3], Variant(*p_args[i]));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// If types already match, don't call Variant::construct(). Constructors of some types
|
||||||
|
// (e.g. packed arrays) do copies, whereas they pass by reference when inside a Variant.
|
||||||
|
if (argument_types[i].is_type(*p_args[i], false)) {
|
||||||
|
memnew_placement(&stack[i + 3], Variant(*p_args[i]));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!argument_types[i].is_type(*p_args[i], true)) {
|
if (!argument_types[i].is_type(*p_args[i], true)) {
|
||||||
r_err.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
r_err.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_err.argument = i;
|
r_err.argument = i;
|
||||||
|
|||||||
Reference in New Issue
Block a user