Repository navigation
ContextMenuController does not dispose OverlayEntry. #130467
Description
Activity
- changed the title
[-]ValueNotifier<_OverlayEntryWidgetState?> is not disposed.[/-][+]ContextMenuController does not dispose OverlayEntry.[/+]on Jul 13, 2023 - addedin triagePresently being triaged by the triage teamPresently being triaged by the triage team
on Jul 13, 2023 Hi @polina-c
I can't findnotDisposedAllowListfrompackages/flutter/test/material/text_form_field_test.dart. Could you give a simple use case of ContextMenuController that causes this issue?- addedwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
on Jul 13, 2023 notDisposedAllowList is added by PR that is linked in description: https://github.com/flutter/flutter/pull/130468/files
- removedwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
on Jul 13, 2023 Feel free to tweet me or to chat me, to setup GVC. I will be happy to explain details.
- addeda: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsa: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesteam-designOwned by Design Languages teamOwned by Design Languages teamand removedin triagePresently being triaged by the triage teamPresently being triaged by the triage team
on Jul 14, 2023 - addedwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
on Jul 17, 2023 This PR reproduces the issue: https://github.com/flutter/flutter/pull/130743/checks?check_run_id=15111140218
- addedin triagePresently being triaged by the triage teamPresently being triaged by the triage teamand removedwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
on Jul 17, 2023 cc @justinmc
- When the test is run with testWidgetsWithLinkTracking, then the EditableTextState (and the whole widget tree in pumpWidget?) is never disposed at the end of the test. If I change it to testWidgets, then it is disposed.
- (Using testWidgetsWithLinkTracking) Bizarrely, if I comment out this line where _handles is set to null, then EditableTextState does get disposed. This is true even if I hack out all of the accesses of _handles after it's set to null, leading me to think something deep behind the scenes is doing this.
@polina-c Is there anything that testWidgetsWithLeakTracking does that could prevent the widget tree from being disposed?
Here's a simpler test that still reproduces the problem:
testWidgetsWithLeakTracking('leak test', (WidgetTester tester) async { final TextEditingController controller = TextEditingController( text: 'blah1 blah2', ); await tester.pumpWidget( MaterialApp( home: Material( child: Center( child: TextField( controller: controller, ), ), ), ), ); final Offset startBlah1 = textOffsetToPosition(tester, 0); await tester.tapAt(startBlah1); await tester.pump(const Duration(milliseconds: 100)); await tester.tapAt(startBlah1); await tester.pumpAndSettle(); }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.macOS }), skip: kIsWeb, // [intended] we don't supply the cut/copy/paste buttons on the web. );
Thanks. For some reasons with leak tracker BuildOwner.finalizeTree is invoked 6 times instead of 7, where 7th one triggers disposal.
At the moment I am refactoring leak tracker for performance, that may side effect in this side effect disappearing.
So, reassigning the issue to me and shelving till after refactoring.Reacted by Justin McCandless- addedP1High-priority issues at the top of the work listHigh-priority issues at the top of the work listand removedin triagePresently being triaged by the triage teamPresently being triaged by the triage team
on Jul 27, 2023 - added a commit that references this issue
on Aug 16, 2023 It seems flakiness disappeared. Returning the issue to you. Remaining leaks:
notDisposed: total: 4 objects: RestorableBool: test: can use the desktop cut/copy/paste buttons on Windows and Linux identityHashCode: 1004453175 RestorableStringN: test: can use the desktop cut/copy/paste buttons on Windows and Linux identityHashCode: 715878348 RestorableBool: test: can use the desktop cut/copy/paste buttons on Windows and Linux identityHashCode: 69970577 RestorableStringN: test: can use the desktop cut/copy/paste buttons on Windows and Linux identityHashCode: 283658580To see callstack for creation, set this config:
leakTrackingTestConfig: const LeakTrackingTestConfig.debugnotDisposed()Reacted by Justin McCandlessThis thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Sep 5, 2023
To repro:
PR that adds notDisposedAllowList: #130468
Creation call stack: https://raw.githubusercontent.com/polina-c/spikes/master/notes/failures/2023-July-12/text_form_field_test_107.txt