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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
5 additions and
1 deletions
-
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; |
|
|
|
|