1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fix for a very obscure race-condition involving font string initialisation.

This commit is contained in:
jules 2014-04-05 17:39:31 +01:00
parent 897c3c8044
commit f4c83a9411
2 changed files with 34 additions and 23 deletions

View file

@ -225,10 +225,13 @@ private:
hits.set (0);
misses.set (0);
return glyphs.getLast();
}
return findLeastRecentlyUsedGlyph();
if (CachedGlyphType* g = findLeastRecentlyUsedGlyph())
return g;
addNewGlyphSlots (32);
return glyphs.getLast();
}
void addNewGlyphSlots (int num)
@ -241,8 +244,8 @@ private:
CachedGlyphType* findLeastRecentlyUsedGlyph() const noexcept
{
CachedGlyphType* oldest = glyphs.getLast();
int oldestCounter = oldest->lastAccessCount;
CachedGlyphType* oldest = nullptr;
int oldestCounter = std::numeric_limits<int>::max();
for (int i = glyphs.size() - 1; --i >= 0;)
{