Fix memory leak in _SelectableTextState (#135049)

This commit is contained in:
Kostia Sokolovskyi 2023-09-21 01:43:44 +02:00 committed by GitHub
parent 1bfd6a1f3c
commit 04854e8aff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 137 additions and 124 deletions

View File

@ -536,6 +536,7 @@ class _SelectableTextState extends State<SelectableText> implements TextSelectio
super.didUpdateWidget(oldWidget);
if (widget.data != oldWidget.data || widget.textSpan != oldWidget.textSpan) {
_controller.removeListener(_onControllerChanged);
_controller.dispose();
_controller = _TextSpanEditingController(
textSpan: widget.textSpan ?? TextSpan(text: widget.data),
);

File diff suppressed because it is too large Load Diff