Skip to content

Commit

Permalink
Fix memory leak in _SelectableTextState (flutter#135049)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksokolovskyi authored and Mairramer committed Oct 10, 2023
1 parent c945686 commit 51b5666
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 124 deletions.
1 change: 1 addition & 0 deletions packages/flutter/lib/src/material/selectable_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
);
Expand Down
Loading

0 comments on commit 51b5666

Please sign in to comment.