Skip to content

Commit

Permalink
[web] Prevent recycling canvas twice due to paint queue (flutter#23315)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferhatb committed Dec 28, 2020
1 parent 06f9654 commit 318ae78
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/web_ui/lib/src/engine/html/picture.dart
Expand Up @@ -51,7 +51,11 @@ class _PaintRequest {
List<_PaintRequest> _paintQueue = <_PaintRequest>[];

void _recycleCanvas(EngineCanvas? canvas) {
assert(canvas == null || !_recycledCanvases.contains(canvas));
// If a canvas is in the paint queue it maybe be recycled. To
// prevent subsequent dispose recycling again check.
if (canvas != null && _recycledCanvases.contains(canvas)) {
return;
}
if (canvas is BitmapCanvas) {
canvas.setElementCache(null);
if (canvas.isReusable()) {
Expand Down

0 comments on commit 318ae78

Please sign in to comment.