-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
GDScript: Fix access non-static members in static context #91412
GDScript: Fix access non-static members in static context #91412
Conversation
dalexeev
commented
May 1, 2024
- Fixes Non-static methods can't be referenced as Callables from static methods #91403.
bd301e8
to
8122a27
Compare
// If the identifier is a member variable (including the native class properties) or a signal, we consider the lambda to be using `self`, so we keep a reference to the current instance. | ||
if (source_is_variable || source_is_signal) { | ||
// If the identifier is a member variable (including the native class properties), member function, or a signal, | ||
// we consider the lambda to be using `self`, so we keep a reference to the current instance. | ||
if (source_is_instance_variable || source_is_instance_function || source_is_signal) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an "unrelated" change, but I guess it makes sense? At least the tests did not detect regressions, but this is not always a reliable criterion.
test_static_var_lambda = null | ||
test_non_static_var_lambda = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes memory leaks in CI. I'm not sure if this is a bug, but it's probably unrelated to the changes since I've noticed this problem before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a reference cycle. Lambda contains a reference to self
which in turn contains a reference to the lambda. Not sure if there's a good way to solve it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks! |