Skip to content

FontStyler.Set: prevent premature disposal of SKTypeface#4958

Merged
swharden merged 3 commits intoScottPlot:mainfrom
sproott:main
Jul 29, 2025
Merged

FontStyler.Set: prevent premature disposal of SKTypeface#4958
swharden merged 3 commits intoScottPlot:mainfrom
sproott:main

Conversation

@sproott
Copy link
Contributor

@sproott sproott commented Jun 5, 2025

This pull request fixes the issue described in #4910.

The SKTypeface object obtained in FontStyler.Set(string fontName) was being disposed of while still being referenced from the internal cache of the Fonts class. By removing the using keyword, the unwanted disposal doesn't happen anymore.

@swharden swharden changed the title Fix: Prevent SKTypeface disposal in FontStyler.Set (#4910) FontStyler.Set: prevent premature disposal of SKTypeface Jul 29, 2025
@swharden swharden linked an issue Jul 29, 2025 that may be closed by this pull request
@swharden
Copy link
Member

Thanks @sproott! This was a very confusing issue to track down, but I appreciate your help figuring it out and recommending this fix!

I'm merging now, and I intend to release an updated NuGet package within the next few weeks.

Thanks again! 🚀
Scott

@swharden swharden enabled auto-merge (squash) July 29, 2025 20:00
@swharden swharden merged commit bf79715 into ScottPlot:main Jul 29, 2025
3 checks passed
swharden added a commit that referenced this pull request Aug 17, 2025
swharden added a commit that referenced this pull request Aug 17, 2025
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.

FontStyler.Set() disposes SKTypeface prematurely

2 participants