Skip to content

Commit acdcbae

Browse files
Revert "Fixing memory leak in EditableTextState" (#133804)
Reverts flutter/flutter#131377 reverting because of internal google testing failures b/298310760
1 parent f32b6fe commit acdcbae

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

packages/flutter/lib/src/widgets/editable_text.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,7 +2125,6 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
21252125
late final Simulation _iosBlinkCursorSimulation = _DiscreteKeyFrameSimulation.iOSBlinkingCaret();
21262126

21272127
final ValueNotifier<bool> _cursorVisibilityNotifier = ValueNotifier<bool>(true);
2128-
late final ValueNotifier<bool> _debugCursorNotifier;
21292128
final GlobalKey _editableKey = GlobalKey();
21302129

21312130
/// Detects whether the clipboard can paste.
@@ -2793,7 +2792,6 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
27932792
_scrollController.addListener(_onEditableScroll);
27942793
_cursorVisibilityNotifier.value = widget.showCursor;
27952794
_spellCheckConfiguration = _inferSpellCheckConfiguration(widget.spellCheckConfiguration);
2796-
_debugCursorNotifier = ValueNotifier<bool>(widget.showCursor);
27972795
}
27982796

27992797
// Whether `TickerMode.of(context)` is true and animations (like blinking the
@@ -2938,7 +2936,6 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
29382936

29392937
@override
29402938
void dispose() {
2941-
_debugCursorNotifier.dispose();
29422939
_internalScrollController?.dispose();
29432940
_currentAutofillScope?.unregister(autofillId);
29442941
widget.controller.removeListener(_didChangeTextEditingValue);
@@ -4860,7 +4857,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
48604857
cursorColor: _cursorColor,
48614858
backgroundCursorColor: widget.backgroundCursorColor,
48624859
showCursor: EditableText.debugDeterministicCursor
4863-
? _debugCursorNotifier
4860+
? ValueNotifier<bool>(widget.showCursor)
48644861
: _cursorVisibilityNotifier,
48654862
forceLine: widget.forceLine,
48664863
readOnly: widget.readOnly,

packages/flutter/test/material/text_selection_theme_test.dart

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,18 @@ void main() {
167167
await tester.pumpAndSettle();
168168
final RenderBox handle = tester.firstRenderObject<RenderBox>(find.byType(CustomPaint));
169169
expect(handle, paints..path(color: defaultSelectionHandleColor));
170-
});
170+
},
171+
// TODO(polina-c): remove after fixing
172+
// https://github.com/flutter/flutter/issues/130469
173+
leakTrackingTestConfig: const LeakTrackingTestConfig(
174+
notDisposedAllowList: <String, int?>{
175+
'ValueNotifier<MagnifierInfo>': 1,
176+
'ValueNotifier<_OverlayEntryWidgetState?>': 2,
177+
'ValueNotifier<bool>': 2,
178+
'_InputBorderGap': 1,
179+
},
180+
),
181+
);
171182

172183
testWidgets('ThemeData.textSelectionTheme will be used if provided', (WidgetTester tester) async {
173184
const TextSelectionThemeData textSelectionTheme = TextSelectionThemeData(

0 commit comments

Comments
 (0)