Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
cc41e25f
Unverified
Commit
cc41e25f
authored
Oct 11, 2023
by
Kostia Sokolovskyi
Committed by
GitHub
Oct 11, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
_RenderSnapshotWidget should dispose created OffsetLayer. (#136267)
parent
54d58474
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
13 deletions
+4
-13
snapshot_widget.dart
packages/flutter/lib/src/widgets/snapshot_widget.dart
+1
-0
snapshot_widget_test.dart
packages/flutter/test/widgets/snapshot_widget_test.dart
+3
-13
No files found.
packages/flutter/lib/src/widgets/snapshot_widget.dart
View file @
cc41e25f
...
@@ -306,6 +306,7 @@ class _RenderSnapshotWidget extends RenderProxyBox {
...
@@ -306,6 +306,7 @@ class _RenderSnapshotWidget extends RenderProxyBox {
// ignore: invalid_use_of_protected_member
// ignore: invalid_use_of_protected_member
context
.
stopRecordingIfNeeded
();
context
.
stopRecordingIfNeeded
();
if
(
mode
!=
SnapshotMode
.
forced
&&
!
offsetLayer
.
supportsRasterization
())
{
if
(
mode
!=
SnapshotMode
.
forced
&&
!
offsetLayer
.
supportsRasterization
())
{
offsetLayer
.
dispose
();
if
(
mode
==
SnapshotMode
.
normal
)
{
if
(
mode
==
SnapshotMode
.
normal
)
{
throw
FlutterError
(
'SnapshotWidget used with a child that contains a PlatformView.'
);
throw
FlutterError
(
'SnapshotWidget used with a child that contains a PlatformView.'
);
}
}
...
...
packages/flutter/test/widgets/snapshot_widget_test.dart
View file @
cc41e25f
...
@@ -217,7 +217,7 @@ void main() {
...
@@ -217,7 +217,7 @@ void main() {
},
skip:
kIsWeb
);
// TODO(jonahwilliams): https://github.com/flutter/flutter/issues/106689
},
skip:
kIsWeb
);
// TODO(jonahwilliams): https://github.com/flutter/flutter/issues/106689
testWidgets
(
'RenderSnapshotWidget throws assertion if platform view is encountered'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'RenderSnapshotWidget throws assertion if platform view is encountered'
,
(
WidgetTester
tester
)
async
{
final
SnapshotController
controller
=
SnapshotController
(
allowSnapshotting:
true
);
final
SnapshotController
controller
=
SnapshotController
(
allowSnapshotting:
true
);
addTearDown
(
controller
.
dispose
);
addTearDown
(
controller
.
dispose
);
...
@@ -286,12 +286,7 @@ void main() {
...
@@ -286,12 +286,7 @@ void main() {
expect
(
tester
.
takeException
(),
isNull
);
expect
(
tester
.
takeException
(),
isNull
);
expect
(
tester
.
layers
.
last
,
isA
<
PlatformViewLayer
>());
expect
(
tester
.
layers
.
last
,
isA
<
PlatformViewLayer
>());
},
},
skip:
kIsWeb
,
// TODO(jonahwilliams): https://github.com/flutter/flutter/issues/106689
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
,
));
testWidgetsWithLeakTracking
(
'SnapshotWidget should have same result when enabled'
,
(
WidgetTester
tester
)
async
{
testWidgetsWithLeakTracking
(
'SnapshotWidget should have same result when enabled'
,
(
WidgetTester
tester
)
async
{
addTearDown
(
tester
.
view
.
reset
);
addTearDown
(
tester
.
view
.
reset
);
...
@@ -330,12 +325,7 @@ void main() {
...
@@ -330,12 +325,7 @@ void main() {
await
expectLater
(
find
.
byKey
(
repaintBoundaryKey
),
matchesReferenceImage
(
imageWhenDisabled
));
await
expectLater
(
find
.
byKey
(
repaintBoundaryKey
),
matchesReferenceImage
(
imageWhenDisabled
));
},
},
skip:
kIsWeb
,
// TODO(jonahwilliams): https://github.com/flutter/flutter/issues/106689
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
},
));
}
}
class
TestPlatformView
extends
SingleChildRenderObjectWidget
{
class
TestPlatformView
extends
SingleChildRenderObjectWidget
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment