Unverified Commit 04854e8a authored by Kostia Sokolovskyi's avatar Kostia Sokolovskyi Committed by GitHub

Fix memory leak in _SelectableTextState (#135049)

parent 1bfd6a1f
...@@ -536,6 +536,7 @@ class _SelectableTextState extends State<SelectableText> implements TextSelectio ...@@ -536,6 +536,7 @@ class _SelectableTextState extends State<SelectableText> implements TextSelectio
super.didUpdateWidget(oldWidget); super.didUpdateWidget(oldWidget);
if (widget.data != oldWidget.data || widget.textSpan != oldWidget.textSpan) { if (widget.data != oldWidget.data || widget.textSpan != oldWidget.textSpan) {
_controller.removeListener(_onControllerChanged); _controller.removeListener(_onControllerChanged);
_controller.dispose();
_controller = _TextSpanEditingController( _controller = _TextSpanEditingController(
textSpan: widget.textSpan ?? TextSpan(text: widget.data), textSpan: widget.textSpan ?? TextSpan(text: widget.data),
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment