I encountered a crash in WindowsTypeface::getOutlineForGlyph
when a text is drawn and at the same time another thread is querying a string width using Font::getStringWidth
.
This is using an older version of JUCE (3.0.5); I’m not sure whether this is relevant for this issue, the according code in juce_win32_fonts.cpp doesn’t seem to have changed much. I’m also rather sure that I only experienced the crash on Windows.
From what I see, the crash is due to some stuff in Font::getStringWidth
that isn’t thread save and shouldn’t be called from threads other than the Message thread.
Of course, one fix would be to move the string width query on the message thread but maybe there is another thread-save solution available to get the width of a string for a certain font?