Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Сheck r_error after calling callp() #96344

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

dalexeev
Copy link
Member

@dalexeev dalexeev commented Aug 30, 2024

The engine has a practice of using return value for error messages if r_error is not CALL_OK. However, r_error is not checked in some places (use = .*\bcallp\b to find them).

So #94511 caused a regression because the Inspector uses bool(object->call("_hide_script_from_inspector")) to determine whether to hide the script property. And PlaceHolderScriptInstance::callp() now returns an error message.

if (p.name == "script" && (hide_script || bool(object->call("_hide_script_from_inspector")))) {
// Hide script variables from inspector if required.
continue;
}

Variant PlaceHolderScriptInstance::callp(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
#if TOOLS_ENABLED
if (Engine::get_singleton()->is_editor_hint()) {
return String("Attempt to call a method on a placeholder instance. Check if the script is in tool mode.");
} else {
return String("Attempt to call a method on a placeholder instance. Probably a bug, please report.");
}
#else
return Variant();
#endif // TOOLS_ENABLED
}

@AThousandShips
Copy link
Member

Does it also fix:

Which seems to be a regression from the same

@akien-mga akien-mga merged commit 6ce4dff into godotengine:master Aug 30, 2024
19 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants