diff --git a/LogoSlideMaker.WinUi/Services/BitmapCache.cs b/LogoSlideMaker.WinUi/Services/BitmapCache.cs index 5cf6245..9fae533 100644 --- a/LogoSlideMaker.WinUi/Services/BitmapCache.cs +++ b/LogoSlideMaker.WinUi/Services/BitmapCache.cs @@ -128,6 +128,11 @@ private async Task 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 @@ -135,6 +140,11 @@ private async Task LoadBitmapAsync(ICanvasResourceCreator resource var randomAccessStream = stream.AsRandomAccessStream(); var result = await CanvasBitmap.LoadAsync(resourceCreator, randomAccessStream); + if (stream is not null) + { + await stream.DisposeAsync(); + } + return result; } }