Skip to content

Media cache clearing never reaches the rayon workers #323

Description

@LeadcodeDev

clear_all_media_caches runs on the calling thread. The font and text caches it should be clearing are thread-local, so it empties the main thread's copy and leaves every rayon worker holding the old one. Those workers are the threads that actually render frames.

Under --watch, editing a custom font file therefore keeps serving the previous face and the previous glyph widths for the rest of the process — a stale preview that looks like a render bug rather than a cache one.

It also does not clear them at all: the function predates CUSTOM_TYPEFACES (already noted as F-RENDER-7 in the audit) and the two caches added in 5b81cd3 inherit the same gap.

Fixing it properly needs a cross-thread mechanism — rayon::broadcast or equivalent — rather than another call on the main thread, which is why the performance lot flagged it instead of adding a clear_* that would have looked correct and done nothing.

Refs #315

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions