-
Notifications
You must be signed in to change notification settings - Fork 28.7k
Dispose widgets to stop leaks. #108193
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
Dispose widgets to stop leaks. #108193
Conversation
@@ -976,6 +976,7 @@ abstract class ScrollPosition extends ViewportOffset with ScrollMetrics { | |||
void dispose() { | |||
activity?.dispose(); // it will be null if it got absorbed by another ScrollPosition | |||
_activity = null; | |||
isScrollingNotifier.dispose(); |
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.
Great to see the leak detection tool catching issues like this!
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.
Nice!
LGTM
// We disable these lints, because they relate to InkResponseState | ||
// that is actually private, but visible for testing. | ||
// ignore_for_file: public_member_api_docs, library_private_types_in_public_api |
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.
Please don't do this. We should try to keep that object private.
If we can't keep it private, we will have to add docs. But We should really try hard to not make this public.
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.
Agreed.
We normally do not test disposal as the testing is complicated. So, I rolled back testing and will request the testing exempt. When we release the leak detector, we will be able to test cover such things.
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
test-exempt: will be tested by #108322 |
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
The leaks are detected by leak-tracker for money app.
We will test cover the change after the leak tracker release.