Skip to content

Commit

Permalink
Merge pull request #7887 from ltetak/feature/skia_crash_on_exit
Browse files Browse the repository at this point in the history
Suppress static SKFont finalizer to prevent crashes on app exit
  • Loading branch information
Gillibald authored Mar 28, 2022
2 parents bf8b8cd + adcc132 commit 6507c4e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Skia/Avalonia.Skia/PlatformRenderInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public PlatformRenderInterface(ISkiaGpu skiaGpu, long? maxResourceBytes = null)
var gl = AvaloniaLocator.Current.GetService<IPlatformOpenGlInterface>();
if (gl != null)
_skiaGpu = new GlSkiaGpu(gl, maxResourceBytes);

//TODO: SKFont crashes when disposed in finalizer so we keep it alive
GC.SuppressFinalize(s_font);
}

public IGeometryImpl CreateEllipseGeometry(Rect rect) => new EllipseGeometryImpl(rect);
Expand Down

0 comments on commit 6507c4e

Please sign in to comment.