diff options
Diffstat (limited to 'Build/source/libs/graphite-engine/src/segment/FontCache.cpp')
-rw-r--r-- | Build/source/libs/graphite-engine/src/segment/FontCache.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Build/source/libs/graphite-engine/src/segment/FontCache.cpp b/Build/source/libs/graphite-engine/src/segment/FontCache.cpp index 041f449a401..f0540463e3b 100644 --- a/Build/source/libs/graphite-engine/src/segment/FontCache.cpp +++ b/Build/source/libs/graphite-engine/src/segment/FontCache.cpp @@ -171,11 +171,9 @@ bool FontCache::RemoveFontFace(std::wstring strFaceName, bool fBold, bool fItali Assert(m_cfface >= 0); - if (m_cfface <= 0 && m_flush == kflushAuto && fZapCache) + if (m_flush == kflushAuto && fZapCache) { - // All items are NULL; delete this cache. Probably this is because - // the program is exiting. - FontFace::ZapFontCache(); + DeleteIfEmpty(); } return fPrevVal; @@ -250,6 +248,17 @@ void FontCache::InsertCacheItem(int ifci) } /*---------------------------------------------------------------------------------------------- + Delete the cache if it is empty. +----------------------------------------------------------------------------------------------*/ +void FontCache::DeleteIfEmpty() +{ + if (m_cfface <= 0) + // All items are NULL; delete this cache. Probably this is because + // the program is exiting. + FontFace::ZapFontCache(); +} + +/*---------------------------------------------------------------------------------------------- Check that the cache is indeed empty. ----------------------------------------------------------------------------------------------*/ void FontCache::AssertEmpty() |