Skip to content

Dispose OverlayEntry in WidgetsApp.router semantics tree structure test - #192995

Merged
auto-submit[bot] merged 1 commit into
flutter:masterfrom
kevmoo:fix-app-test-leak
Sep 21, 2026
Merged

auto-submit[bot] merged 1 commit into
flutter:masterfrom
kevmoo:fix-app-test-leak

Conversation

@kevmoo

@kevmoo kevmoo commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

In #192601, the 'WidgetsApp.router produces expected semantics tree structure' test added in packages/flutter/test/widgets/app_test.dart registered addTearDown(entry.remove) for its OverlayEntry without calling entry.dispose().

Because OverlayEntry allocates an internal ValueNotifier<_OverlayEntryWidgetState?> that is only disposed in OverlayEntry.dispose(), Windows framework_tests_widgets_leak_tracking failed in tearDownAll with 2 undisposed objects (OverlayEntry and ValueNotifier<_OverlayEntryWidgetState?>).

This change updates the tear-down callback to call both entry.remove() and entry.dispose(), matching packages/flutter/test/widgets/overlay_test.dart.

Fixes #192993

Pre-launch Checklist

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?>).
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Sep 18, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

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.

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.

Comment thread packages/flutter/test/widgets/app_test.dart
@github-actions github-actions Bot added the framework flutter/packages/flutter repository. See also f: labels. label Sep 18, 2026
@flutter-dashboard

Copy link
Copy Markdown

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 package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #192995 at sha d057ffb

@flutter-dashboard flutter-dashboard Bot added the will affect goldens Changes to golden files label Sep 18, 2026
@kevmoo
kevmoo requested a review from jtmcdole September 21, 2026 16:43
@kevmoo kevmoo added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD framework flutter/packages/flutter repository. See also f: labels. will affect goldens Changes to golden files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows framework_tests_widgets_leak_tracking is broken by #192601

2 participants