diff --git a/src/Microsoft.Maui.Graphics.Skia/SkiaCanvas.cs b/src/Microsoft.Maui.Graphics.Skia/SkiaCanvas.cs index bf14011..3a239ca 100644 --- a/src/Microsoft.Maui.Graphics.Skia/SkiaCanvas.cs +++ b/src/Microsoft.Maui.Graphics.Skia/SkiaCanvas.cs @@ -24,6 +24,12 @@ namespace Microsoft.Maui.Graphics.Skia static SkiaCanvasStateService CreateStateService(out SkiaCanvasStateService stateService) => stateService = new SkiaCanvasStateService(); + public override void Dispose() + { + _stateService.Dispose(); + base.Dispose(); + } + public override float DisplayScale => _displayScale; public SKCanvas Canvas diff --git a/src/Microsoft.Maui.Graphics.Skia/SkiaCanvasStateService.cs b/src/Microsoft.Maui.Graphics.Skia/SkiaCanvasStateService.cs index e427e8a..32d9d80 100644 --- a/src/Microsoft.Maui.Graphics.Skia/SkiaCanvasStateService.cs +++ b/src/Microsoft.Maui.Graphics.Skia/SkiaCanvasStateService.cs @@ -5,9 +5,9 @@ namespace Microsoft.Maui.Graphics.Skia { public class SkiaCanvasStateService : IDisposable, ICanvasStateService { - private static SKPaint _defaultFillPaint; - private static SKPaint _defaultFontPaint; - private static SKPaint _defaultStrokePaint; + private SKPaint _defaultFillPaint; + private SKPaint _defaultFontPaint; + private SKPaint _defaultStrokePaint; public SkiaCanvasState CreateNew(object context) { diff --git a/src/Microsoft.Maui.Graphics/Android/PlatformCanvas.cs b/src/Microsoft.Maui.Graphics/Android/PlatformCanvas.cs index 926da96..ff93748 100644 --- a/src/Microsoft.Maui.Graphics/Android/PlatformCanvas.cs +++ b/src/Microsoft.Maui.Graphics/Android/PlatformCanvas.cs @@ -26,6 +26,12 @@ namespace Microsoft.Maui.Graphics.Platform static PlatformCanvasStateService CreateStateService(out PlatformCanvasStateService stateService) => stateService = new PlatformCanvasStateService(); + public override void Dispose() + { + _stateService.Dispose(); + base.Dispose(); + } + public Canvas Canvas { get => _canvas;