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
clear_all_media_cachesruns 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 in5b81cd3inherit the same gap.Fixing it properly needs a cross-thread mechanism —
rayon::broadcastor equivalent — rather than another call on the main thread, which is why the performance lot flagged it instead of adding aclear_*that would have looked correct and done nothing.Refs #315