Skip to content

Make sure to not dispose system fonts#1224

Merged
mattleibow merged 5 commits into
masterfrom
dev/fix-1220
Apr 11, 2020
Merged

Make sure to not dispose system fonts#1224
mattleibow merged 5 commits into
masterfrom
dev/fix-1220

Conversation

@mattleibow

@mattleibow mattleibow commented Apr 10, 2020

Copy link
Copy Markdown
Contributor

Description of Change

Make sure to not dispose system fonts.

SKFontManager and SKTypeface return a cached/singleton for system fonts. Do not dispose these because they may be in use in other parts of drawing code.

Because it is actually reference counted on the native side, we can allow the GC to collect it still. When the GC is working, this means that there are no more managed references and a disposal of the managed object will do nothing bad.

Bugs Fixed

API Changes

SKFontManager.SKTypeface MatchFamily (string familyName);

Behavioral Changes

System fonts are no longer disposed.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard
  • Updated documentation

@mattleibow

Copy link
Copy Markdown
Contributor Author

Released to NuGet as version 1.68.2-preview.60

@mattleibow mattleibow added this to the v1.68.2 milestone Apr 29, 2020
mattleibow added a commit that referenced this pull request Jul 3, 2026
Expand the skill's scan taxonomy from 6 to 12 families, each backed by a
real historical SkiaSharp leak fix (finalizer/collection ordering #3796/#3291,
Clone double-free #2904, disposing native statics #1863/#4080/#1224,
field-not-nulled #1256/#1344, stream/callback/delegate-proxy lifetime
#3589/#2916/#996, allocation-failure #1784/#1642). Broaden Phase 1.3 de-dup to
search by api/type name (real leaks are filed as [BUG], not [memory-leak]) and
add the Blob.FromStream / PR #3473 worked example. Extend the Phase 3.2 fix
table to cover all 12 families. Document two verified, un-filed family-6
candidates surfaced by a model-diverse scan (SKRegion.SpanIterator missing
parent ref; SKPixmap.ExtractSubset/With* not propagating pixelSource).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Multithreaded Crash with SKShaper and SKTypeFace [BUG] NullReferenceException occurs when use SKTypeface and SKPaint in multi Threading

1 participant