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

Unify debug/non-debug behavior of ClassDB::get_method_info() #78537

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

anvilfolk
Copy link
Contributor

@anvilfolk anvilfolk commented Jun 21, 2023

Currently only debug builds allow ClassDB::get_method_info() to check for virtual methods. As a result, debug builds will not generate errors when e.g. calling virtual methods (meant to act as a no-op). Non-debug builds, however, will complain that those methods do not exist, when they should also behave as a no-op.

Fixes #76938 (again).

This is failing release builds because the information about virtual methods currently does not get stored in release builds. For this to work, we'd need to store that information, which doesn't feel great - but there might not be a way around that.

Thoughts?

@anvilfolk anvilfolk requested a review from a team as a code owner June 21, 2023 20:06
@anvilfolk anvilfolk marked this pull request as draft June 21, 2023 20:09
@anvilfolk anvilfolk force-pushed the unify-classDB-method-info branch from de83993 to f14987d Compare June 21, 2023 20:35
@@ -116,12 +116,12 @@ class ClassDB {
HashMap<StringName, MethodInfo> signal_map;
List<PropertyInfo> property_list;
HashMap<StringName, PropertyInfo> property_map;
List<MethodInfo> virtual_methods;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% certain that moving virtual_methods out of DEBUG_METHODS_ENABLED is absolutely needed to fix the linked issue, but this makes the handling of virtual methods consistent, e.g. you can find the same things through get_method_info(), and get_method_list().

@Chaosus Chaosus added this to the 4.x milestone Jun 22, 2023
Currently only debug builds allow `ClassDB::get_method_info()` to check
for virtual methods. As a result, debug builds will not generate errors
when e.g. calling virtual methods (meant to act as a no-op). Non-debug
builds, however, will complain that those methods do not exist, when
they should also behave as a no-op.

Fixes godotengine#76938 (again).
@anvilfolk anvilfolk force-pushed the unify-classDB-method-info branch from f14987d to ccb6c85 Compare July 7, 2023 18:35
@anvilfolk anvilfolk marked this pull request as ready for review July 7, 2023 21:14
@RedMser
Copy link
Contributor

RedMser commented Sep 18, 2023

This might fix #65534 as well? Although reduz commented there saying this is done by design.

@YuriSizov
Copy link
Contributor

The linked issue seems to be fixed by your other PR now, #81808.

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

Successfully merging this pull request may close these issues.

super() causing script error when overriding _init() on the child class and not the parent in release builds
4 participants