Skip to content

GSHorizontalTypesetter improvements: Fix Memory Management of Cached Fonts #413

Description

@IOOI-SqAR

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
    // ...
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions