Skip to content

Commit

Permalink
fix(ui): Displose of image streams after loading
Browse files Browse the repository at this point in the history
Fixes #38
  • Loading branch information
jcoliz committed Jul 19, 2024
1 parent 6099153 commit 7e823d4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions LogoSlideMaker.WinUi/Services/BitmapCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,23 @@ private async Task<CanvasBitmap> LoadBitmapAsync(ICanvasResourceCreator resource
var randomAccessStream = pngStream.AsRandomAccessStream();
var result = await CanvasBitmap.LoadAsync(resourceCreator, randomAccessStream);

if (stream is not null)
{
await stream.DisposeAsync();
}

return result;
}
else
{
var randomAccessStream = stream.AsRandomAccessStream();
var result = await CanvasBitmap.LoadAsync(resourceCreator, randomAccessStream);

if (stream is not null)
{
await stream.DisposeAsync();
}

return result;
}
}
Expand Down

0 comments on commit 7e823d4

Please sign in to comment.