-
Notifications
You must be signed in to change notification settings - Fork 397
Enable dispose-class-fields and dispose-fields lints to resolve memory leaks
#9857
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,6 +86,7 @@ class _AppSizeBodyState extends State<AppSizeBody> | |
| ); | ||
| static final tabs = [analysisTab, diffTab]; | ||
|
|
||
| // ignore: dispose-fields, screen controller disposal is handled by the [ScreenControllers] class. | ||
| late AppSizeController controller; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @incendial is there also a way to detect when a class is not the owner of an object and therefore should not be responsible for disposing it?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That should be fixed as well |
||
|
|
||
| late final TabController _tabController; | ||
|
|
@@ -390,6 +391,7 @@ class AnalysisView extends StatefulWidget { | |
| } | ||
|
|
||
| class _AnalysisViewState extends State<AnalysisView> with AutoDisposeMixin { | ||
| // ignore: dispose-fields, screen controller disposal is handled by the [ScreenControllers] class. | ||
| late AppSizeController controller; | ||
|
|
||
| TreemapNode? analysisRoot; | ||
|
|
@@ -482,6 +484,7 @@ class DiffView extends StatefulWidget { | |
| } | ||
|
|
||
| class _DiffViewState extends State<DiffView> with AutoDisposeMixin { | ||
| // ignore: dispose-fields, screen controller disposal is handled by the [ScreenControllers] class. | ||
| late AppSizeController controller; | ||
|
|
||
| TreemapNode? diffRoot; | ||
|
|
||
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.
@incendial FYI several false positives in this PR when the object is disposed by another layer of abstraction.
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.
Thanks, I've went though all the cases and I believe the vast majority is fixed (the only tricky one left is with
applyToFeatureControllers). Fixes will be in1.38.0which ships today