I asked the Kimi AI how to further improve GSHorizontalTypesetter. Here is what it came up with:
https://www.kimi.com/share/19d34cdb-8242-8fc9-8000-00001fd46e3b
Fix Memory Management of Cached Fonts
The glyph cache stores NSFont * without retaining. If the font is deallocated externally, this becomes a dangling pointer:
// PROPOSED: In GlyphCacheEntry, use __strong or retain explicitly
// Or better, store font index/identifier rather than pointer
struct GSHorizontalTypesetterGlyphCacheStruct {
// ...
NSUInteger fontIndex; // Index into layout manager's font cache
// ...
};
I asked the Kimi AI how to further improve GSHorizontalTypesetter. Here is what it came up with:
https://www.kimi.com/share/19d34cdb-8242-8fc9-8000-00001fd46e3b
Fix Memory Management of Cached Fonts
The glyph cache stores
NSFont *without retaining. If the font is deallocated externally, this becomes a dangling pointer: