Unverified Commit 8953ba65 authored by Kostia Sokolovskyi's avatar Kostia Sokolovskyi Committed by GitHub

Fix memory leak in Overlay.wrap. (#145744)

parent 15832892
...@@ -863,6 +863,12 @@ class _WrappingOverlayState extends State<_WrappingOverlay> { ...@@ -863,6 +863,12 @@ class _WrappingOverlayState extends State<_WrappingOverlay> {
_entry.markNeedsBuild(); _entry.markNeedsBuild();
} }
@override
void dispose() {
_entry..remove()..dispose();
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Overlay( return Overlay(
......
...@@ -1550,10 +1550,7 @@ void main() { ...@@ -1550,10 +1550,7 @@ void main() {
}); });
}); });
testWidgets('Overlay.wrap', testWidgets('Overlay.wrap', (WidgetTester tester) async {
// TODO(ksokolovskyi): dispose OverlayEntry, https://github.com/flutter/flutter/issues/145687 [leaks-to-clean]
experimentalLeakTesting: LeakTesting.settings.withIgnoredAll(),
(WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
...@@ -1585,10 +1582,7 @@ void main() { ...@@ -1585,10 +1582,7 @@ void main() {
expect(tester.state(find.byType(Overlay)), same(overlayState)); expect(tester.state(find.byType(Overlay)), same(overlayState));
}); });
testWidgets('Overlay.wrap is sized by child in an unconstrained environment', testWidgets('Overlay.wrap is sized by child in an unconstrained environment', (WidgetTester tester) async {
// TODO(ksokolovskyi): dispose OverlayEntry, https://github.com/flutter/flutter/issues/145687 [leaks-to-clean]
experimentalLeakTesting: LeakTesting.settings.withIgnoredAll(),
(WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
......
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