Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
4b89fce1
Unverified
Commit
4b89fce1
authored
Aug 30, 2023
by
Renzo Olivares
Committed by
GitHub
Aug 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing memory leak in EditableTextState (#131377)
parent
d1410a11
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
13 deletions
+5
-13
editable_text.dart
packages/flutter/lib/src/widgets/editable_text.dart
+4
-1
text_selection_theme_test.dart
...ages/flutter/test/material/text_selection_theme_test.dart
+1
-12
No files found.
packages/flutter/lib/src/widgets/editable_text.dart
View file @
4b89fce1
...
@@ -2125,6 +2125,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
...
@@ -2125,6 +2125,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
late
final
Simulation
_iosBlinkCursorSimulation
=
_DiscreteKeyFrameSimulation
.
iOSBlinkingCaret
();
late
final
Simulation
_iosBlinkCursorSimulation
=
_DiscreteKeyFrameSimulation
.
iOSBlinkingCaret
();
final
ValueNotifier
<
bool
>
_cursorVisibilityNotifier
=
ValueNotifier
<
bool
>(
true
);
final
ValueNotifier
<
bool
>
_cursorVisibilityNotifier
=
ValueNotifier
<
bool
>(
true
);
late
final
ValueNotifier
<
bool
>
_debugCursorNotifier
;
final
GlobalKey
_editableKey
=
GlobalKey
();
final
GlobalKey
_editableKey
=
GlobalKey
();
/// Detects whether the clipboard can paste.
/// Detects whether the clipboard can paste.
...
@@ -2789,6 +2790,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
...
@@ -2789,6 +2790,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
_scrollController
.
addListener
(
_onEditableScroll
);
_scrollController
.
addListener
(
_onEditableScroll
);
_cursorVisibilityNotifier
.
value
=
widget
.
showCursor
;
_cursorVisibilityNotifier
.
value
=
widget
.
showCursor
;
_spellCheckConfiguration
=
_inferSpellCheckConfiguration
(
widget
.
spellCheckConfiguration
);
_spellCheckConfiguration
=
_inferSpellCheckConfiguration
(
widget
.
spellCheckConfiguration
);
_debugCursorNotifier
=
ValueNotifier
<
bool
>(
widget
.
showCursor
);
}
}
// Whether `TickerMode.of(context)` is true and animations (like blinking the
// Whether `TickerMode.of(context)` is true and animations (like blinking the
...
@@ -2933,6 +2935,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
...
@@ -2933,6 +2935,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
@override
@override
void
dispose
()
{
void
dispose
()
{
_debugCursorNotifier
.
dispose
();
_internalScrollController
?.
dispose
();
_internalScrollController
?.
dispose
();
_currentAutofillScope
?.
unregister
(
autofillId
);
_currentAutofillScope
?.
unregister
(
autofillId
);
widget
.
controller
.
removeListener
(
_didChangeTextEditingValue
);
widget
.
controller
.
removeListener
(
_didChangeTextEditingValue
);
...
@@ -4853,7 +4856,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
...
@@ -4853,7 +4856,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
cursorColor:
_cursorColor
,
cursorColor:
_cursorColor
,
backgroundCursorColor:
widget
.
backgroundCursorColor
,
backgroundCursorColor:
widget
.
backgroundCursorColor
,
showCursor:
EditableText
.
debugDeterministicCursor
showCursor:
EditableText
.
debugDeterministicCursor
?
ValueNotifier
<
bool
>(
widget
.
showCursor
)
?
_debugCursorNotifier
:
_cursorVisibilityNotifier
,
:
_cursorVisibilityNotifier
,
forceLine:
widget
.
forceLine
,
forceLine:
widget
.
forceLine
,
readOnly:
widget
.
readOnly
,
readOnly:
widget
.
readOnly
,
...
...
packages/flutter/test/material/text_selection_theme_test.dart
View file @
4b89fce1
...
@@ -167,18 +167,7 @@ void main() {
...
@@ -167,18 +167,7 @@ void main() {
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
final
RenderBox
handle
=
tester
.
firstRenderObject
<
RenderBox
>(
find
.
byType
(
CustomPaint
));
final
RenderBox
handle
=
tester
.
firstRenderObject
<
RenderBox
>(
find
.
byType
(
CustomPaint
));
expect
(
handle
,
paints
..
path
(
color:
defaultSelectionHandleColor
));
expect
(
handle
,
paints
..
path
(
color:
defaultSelectionHandleColor
));
},
});
// TODO(polina-c): remove after fixing
// https://github.com/flutter/flutter/issues/130469
leakTrackingTestConfig:
const
LeakTrackingTestConfig
(
notDisposedAllowList:
<
String
,
int
?>{
'ValueNotifier<MagnifierInfo>'
:
1
,
'ValueNotifier<_OverlayEntryWidgetState?>'
:
2
,
'ValueNotifier<bool>'
:
2
,
'_InputBorderGap'
:
1
,
},
),
);
testWidgets
(
'ThemeData.textSelectionTheme will be used if provided'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'ThemeData.textSelectionTheme will be used if provided'
,
(
WidgetTester
tester
)
async
{
const
TextSelectionThemeData
textSelectionTheme
=
TextSelectionThemeData
(
const
TextSelectionThemeData
textSelectionTheme
=
TextSelectionThemeData
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment