Browse Source

Merge pull request #3728 from MarcusWichelmann/fix-remote-widget-memory-leak

Fixed memory leak in RemoteWidget
pull/3741/head
Nikita Tsukanov 6 years ago
committed by GitHub
parent
commit
1eb32a9369
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/Avalonia.Controls/Remote/RemoteWidget.cs

6
src/Avalonia.Controls/Remote/RemoteWidget.cs

@ -75,7 +75,11 @@ namespace Avalonia.Controls.Remote
var fmt = (PixelFormat) _lastFrame.Format;
if (_bitmap == null || _bitmap.PixelSize.Width != _lastFrame.Width ||
_bitmap.PixelSize.Height != _lastFrame.Height)
_bitmap = new WriteableBitmap(new PixelSize(_lastFrame.Width, _lastFrame.Height), new Vector(96, 96), fmt);
{
_bitmap?.Dispose();
_bitmap = new WriteableBitmap(new PixelSize(_lastFrame.Width, _lastFrame.Height),
new Vector(96, 96), fmt);
}
using (var l = _bitmap.Lock())
{
var lineLen = (fmt == PixelFormat.Rgb565 ? 2 : 4) * _lastFrame.Width;

Loading…
Cancel
Save