Skip to content

Dispose widgets to stop leaks. - #108193

Merged
polina-c merged 8 commits into
flutter:masterfrom
polina-c:dispose-for-money-app
Jul 26, 2022
Merged

polina-c merged 8 commits into
flutter:masterfrom
polina-c:dispose-for-money-app

Conversation

@polina-c

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

Copy link
Copy Markdown
Contributor

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 p: material_ui material_ui package in flutter/packages f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. labels Jul 22, 2022
void dispose() {
activity?.dispose(); // it will be null if it got absorbed by another ScrollPosition
_activity = null;
isScrollingNotifier.dispose();

Copy link
Copy Markdown
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

@goderbauer goderbauer left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
Contributor Author

@Hixie

Hixie commented Jul 25, 2022

Copy link
Copy Markdown
Contributor

test-exempt: will be tested by #108322

@goderbauer goderbauer left a comment

Copy link
Copy Markdown
Member

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: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants