Repository navigation
Dispose OverlayEntry in WidgetsApp.router semantics tree structure test - #192995
Conversation
In flutter#192601, the 'WidgetsApp.router produces expected semantics tree structure' test added an OverlayEntry with addTearDown(entry.remove), omitting entry.dispose(). This caused Windows framework_tests_widgets_leak_tracking to report 2 undisposed objects (OverlayEntry and ValueNotifier<_OverlayEntryWidgetState?>).
There was a problem hiding this comment.
Code Review
This pull request modifies a test teardown in packages/flutter/test/widgets/app_test.dart to both remove and dispose of an OverlayEntry. The review feedback suggests checking if the entry is mounted before calling remove() to prevent potential assertion errors from masking the original test failure if the test fails before insertion.
|
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
In #192601, the
'WidgetsApp.router produces expected semantics tree structure'test added inpackages/flutter/test/widgets/app_test.dartregisteredaddTearDown(entry.remove)for itsOverlayEntrywithout callingentry.dispose().Because
OverlayEntryallocates an internalValueNotifier<_OverlayEntryWidgetState?>that is only disposed inOverlayEntry.dispose(),Windows framework_tests_widgets_leak_trackingfailed intearDownAllwith 2 undisposed objects (OverlayEntryandValueNotifier<_OverlayEntryWidgetState?>).This change updates the tear-down callback to call both
entry.remove()andentry.dispose(), matchingpackages/flutter/test/widgets/overlay_test.dart.Fixes #192993
Pre-launch Checklist
///).