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

LruCache: Make the LRU cache implementation thread safe

This commit is contained in:
Anthony Nicholls 2025-07-30 13:35:11 +01:00 committed by Anthony Nicholls
parent c1affc0a0e
commit 667b3fae86
3 changed files with 35 additions and 6 deletions

View file

@ -479,7 +479,7 @@ RectangleListSpriteBatch::~RectangleListSpriteBatch()
void RectangleListSpriteBatch::release()
{
whiteRectangle = nullptr;
spriteBatches = {};
spriteBatches.clear();
destinations.free();
destinationsCapacity = 0;
}

View file

@ -196,13 +196,11 @@ public:
//==============================================================================
void reset()
{
const ScopedLock sl { lock };
cache = {};
cache.clear();
}
const auto& get (const Font& font, const int glyphNumber)
{
const ScopedLock sl { lock };
return cache.get (Key { font, glyphNumber }, [] (const auto& key)
{
auto fontHeight = key.font.getHeight();
@ -233,7 +231,6 @@ private:
};
LruCache<Key, std::vector<GlyphLayer>> cache;
CriticalSection lock;
static GlyphCache*& getSingletonPointer() noexcept
{