`next_gen_ui_demo`: Stop `Picture`s leaking (#1871)

pull/1879/head
Brett Morgan 1 year ago committed by GitHub
parent dd4fc132a1
commit c616e3213c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -296,6 +296,8 @@ class _RenderShaderSamplerBuilderWidget extends RenderProxyBox {
class _ShaderSamplerBuilderLayer extends OffsetLayer { class _ShaderSamplerBuilderLayer extends OffsetLayer {
_ShaderSamplerBuilderLayer(this._callback); _ShaderSamplerBuilderLayer(this._callback);
ui.Picture? _lastPicture;
Size get size => _size; Size get size => _size;
Size _size = Size.zero; Size _size = Size.zero;
set size(Size value) { set size(Size value) {
@ -353,7 +355,8 @@ class _ShaderSamplerBuilderLayer extends OffsetLayer {
} finally { } finally {
image.dispose(); image.dispose();
} }
final ui.Picture picture = pictureRecorder.endRecording(); _lastPicture?.dispose();
builder.addPicture(offset, picture); _lastPicture = pictureRecorder.endRecording();
builder.addPicture(offset, _lastPicture!);
} }
} }

Loading…
Cancel
Save