Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 8 commits into from
Jul 26, 2022
Merged

Dispose widgets to stop leaks. #108193

merged 8 commits into from
Jul 26, 2022

Conversation

polina-c
Copy link
Contributor

@polina-c polina-c commented Jul 22, 2022

The leaks are detected by leak-tracker for money app.

We will test cover the change after the leak tracker release.

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. labels Jul 22, 2022
@@ -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();
Copy link
Contributor

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!

@polina-c polina-c marked this pull request as ready for review July 22, 2022 21:35
Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

Nice!

LGTM

Comment on lines 5 to 7
// 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
Copy link
Member

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.

Copy link
Contributor Author

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.

@flutter-dashboard
Copy link

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.

@polina-c
Copy link
Contributor Author

@Hixie
Copy link
Contributor

Hixie commented Jul 25, 2022

test-exempt: will be tested by #108322

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
f: material design flutter/packages/flutter/material repository. f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants