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
4d9a3753
Unverified
Commit
4d9a3753
authored
Jul 07, 2021
by
Dan Field
Committed by
GitHub
Jul 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Assert disposed layers are not reused (#85798)
parent
3ca4e288
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
17 deletions
+11
-17
layer.dart
packages/flutter/lib/src/rendering/layer.dart
+2
-4
layers_test.dart
packages/flutter/test/rendering/layers_test.dart
+8
-10
object_paint_dispose_test.dart
...ges/flutter/test/rendering/object_paint_dispose_test.dart
+1
-3
No files found.
packages/flutter/lib/src/rendering/layer.dart
View file @
4d9a3753
...
...
@@ -148,8 +148,7 @@ abstract class Layer extends AbstractNode with DiagnosticableTreeMixin {
}());
return
disposed
;
}
// TODO(dnfield): https://github.com/flutter/flutter/issues/85066
final
bool
_debugDisposed
=
false
;
bool
_debugDisposed
=
false
;
/// Set when this layer is appended to a [ContainerLayer], and
/// unset when it is removed.
...
...
@@ -220,8 +219,7 @@ abstract class Layer extends AbstractNode with DiagnosticableTreeMixin {
'Do not directly call dispose on a
$runtimeType
. Instead, '
'use createHandle and LayerHandle.dispose.'
,
);
// TODO(dnfield): enable this. https://github.com/flutter/flutter/issues/85066
// _debugDisposed = true;
_debugDisposed
=
true
;
return
true
;
}());
_engineLayer
?.
dispose
();
...
...
packages/flutter/test/rendering/layers_test.dart
View file @
4d9a3753
...
...
@@ -602,13 +602,11 @@ void main() {
parent
.
buildScene
(
SceneBuilder
());
},
skip:
isBrowser
);
// TODO(yjbanov): `toImage` doesn't work on the Web: https://github.com/flutter/flutter/issues/42767
// TODO(dnfield): remove this when https://github.com/flutter/flutter/issues/85066 is resolved.
const
bool
bug85066
=
true
;
test
(
'PictureLayer does not let you call dispose unless refcount is 0'
,
()
{
PictureLayer
layer
=
PictureLayer
(
Rect
.
zero
);
expect
(
layer
.
debugHandleCount
,
0
);
layer
.
dispose
();
expect
(
layer
.
debugDisposed
,
true
,
skip:
bug85066
);
expect
(
layer
.
debugDisposed
,
true
);
layer
=
PictureLayer
(
Rect
.
zero
);
final
LayerHandle
<
PictureLayer
>
handle
=
LayerHandle
<
PictureLayer
>(
layer
);
...
...
@@ -616,8 +614,8 @@ void main() {
expect
(()
=>
layer
.
dispose
(),
throwsAssertionError
);
handle
.
layer
=
null
;
expect
(
layer
.
debugHandleCount
,
0
);
expect
(
layer
.
debugDisposed
,
true
,
skip:
bug85066
);
expect
(()
=>
layer
.
dispose
(),
throwsAssertionError
,
skip:
bug85066
);
// already disposed.
expect
(
layer
.
debugDisposed
,
true
);
expect
(()
=>
layer
.
dispose
(),
throwsAssertionError
);
// already disposed.
});
test
(
'Layer append/remove increases/decreases handle count'
,
()
{
...
...
@@ -632,7 +630,7 @@ void main() {
layer
.
remove
();
expect
(
layer
.
debugHandleCount
,
0
);
expect
(
layer
.
debugDisposed
,
true
,
skip:
bug85066
);
expect
(
layer
.
debugDisposed
,
true
);
});
test
(
'Layer.dispose disposes the engineLayer'
,
()
{
...
...
@@ -693,17 +691,17 @@ void main() {
holder
.
layer
=
layer2
;
expect
(
layer
.
debugHandleCount
,
0
);
expect
(
layer
.
debugDisposed
,
true
,
skip:
bug85066
);
expect
(
layer
.
debugDisposed
,
true
);
expect
(
layer2
.
debugHandleCount
,
1
);
expect
(
layer2
.
debugDisposed
,
false
);
holder
.
layer
=
null
;
expect
(
layer
.
debugHandleCount
,
0
);
expect
(
layer
.
debugDisposed
,
true
,
skip:
bug85066
);
expect
(
layer
.
debugDisposed
,
true
);
expect
(
layer2
.
debugHandleCount
,
0
);
expect
(
layer2
.
debugDisposed
,
true
,
skip:
bug85066
);
expect
(
layer2
.
debugDisposed
,
true
);
expect
(()
=>
holder
.
layer
=
layer
,
throwsAssertionError
,
skip:
bug85066
);
expect
(()
=>
holder
.
layer
=
layer
,
throwsAssertionError
);
});
}
...
...
packages/flutter/test/rendering/object_paint_dispose_test.dart
View file @
4d9a3753
...
...
@@ -7,8 +7,6 @@ import 'package:flutter/widgets.dart';
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
// TODO(dnfield): remove when https://github.com/flutter/flutter/issues/85066 is resolved.
const
bool
bug85066
=
true
;
testWidgets
(
'Tracks picture layers accurately when painting is interleaved with a pushLayer'
,
(
WidgetTester
tester
)
async
{
// Creates a RenderObject that will paint into multiple picture layers.
// Asserts that both layers get a handle, and that all layers get correctly
...
...
@@ -34,7 +32,7 @@ void main() {
await
tester
.
pumpWidget
(
const
SizedBox
());
for
(
final
Layer
layer
in
layers
)
{
expect
(
layer
.
debugDisposed
,
true
,
skip:
bug85066
);
expect
(
layer
.
debugDisposed
,
true
);
}
expect
(
renderObject
.
debugDisposed
,
true
);
});
...
...
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