RenderParagraph should dispose instances of SelectableFragments. (#133915)

This commit is contained in:
Polina Cherkasova 2023-09-05 13:40:14 -07:00 committed by GitHub
parent c9f70e9fd2
commit af1b7494d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View File

@ -437,9 +437,7 @@ class RenderParagraph extends RenderBox with ContainerRenderObjectMixin<RenderBo
@override
void dispose() {
_removeSelectionRegistrarSubscription();
// _lastSelectableFragments may hold references to this RenderParagraph.
// Release them manually to avoid retain cycles.
_lastSelectableFragments = null;
_disposeSelectableFragments();
_textPainter.dispose();
super.dispose();
}

View File

@ -1684,7 +1684,7 @@ void main() {
expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.basic);
});
testWidgets('ElevatedButton in SelectionArea changes mouse cursor when hovered', (WidgetTester tester) async {
testWidgetsWithLeakTracking('ElevatedButton in SelectionArea changes mouse cursor when hovered', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/104595.
await tester.pumpWidget(MaterialApp(
home: SelectionArea(