Unverified Commit cc41e25f authored by Kostia Sokolovskyi's avatar Kostia Sokolovskyi Committed by GitHub

_RenderSnapshotWidget should dispose created OffsetLayer. (#136267)

parent 54d58474
......@@ -306,6 +306,7 @@ class _RenderSnapshotWidget extends RenderProxyBox {
// ignore: invalid_use_of_protected_member
context.stopRecordingIfNeeded();
if (mode != SnapshotMode.forced && !offsetLayer.supportsRasterization()) {
offsetLayer.dispose();
if (mode == SnapshotMode.normal) {
throw FlutterError('SnapshotWidget used with a child that contains a PlatformView.');
}
......
......@@ -217,7 +217,7 @@ void main() {
}, skip: kIsWeb); // TODO(jonahwilliams): https://github.com/flutter/flutter/issues/106689
testWidgets('RenderSnapshotWidget throws assertion if platform view is encountered', (WidgetTester tester) async {
testWidgetsWithLeakTracking('RenderSnapshotWidget throws assertion if platform view is encountered', (WidgetTester tester) async {
final SnapshotController controller = SnapshotController(allowSnapshotting: true);
addTearDown(controller.dispose);
......@@ -286,12 +286,7 @@ void main() {
expect(tester.takeException(), isNull);
expect(tester.layers.last, isA<PlatformViewLayer>());
},
skip: kIsWeb, // TODO(jonahwilliams): https://github.com/flutter/flutter/issues/106689
leakTrackingTestConfig: const LeakTrackingTestConfig(
// TODO(ksokolovskyi): remove after fixing
// https://github.com/flutter/flutter/issues/135141
allowAllNotDisposed: true,
));
skip: kIsWeb); // TODO(jonahwilliams): https://github.com/flutter/flutter/issues/106689
testWidgetsWithLeakTracking('SnapshotWidget should have same result when enabled', (WidgetTester tester) async {
addTearDown(tester.view.reset);
......@@ -330,12 +325,7 @@ void main() {
await expectLater(find.byKey(repaintBoundaryKey), matchesReferenceImage(imageWhenDisabled));
},
skip: kIsWeb, // TODO(jonahwilliams): https://github.com/flutter/flutter/issues/106689
leakTrackingTestConfig: const LeakTrackingTestConfig(
// TODO(ksokolovskyi): remove after fixing
// https://github.com/flutter/flutter/issues/135137
notDisposedAllowList: <String, int> {'Image': 1},
));
skip: kIsWeb); // TODO(jonahwilliams): https://github.com/flutter/flutter/issues/106689
}
class TestPlatformView extends SingleChildRenderObjectWidget {
......
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