diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-13 14:50:13 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-15 08:40:50 +0200 |
commit | 0b6f2f3ff47b6f1455d213bee4b257542e527976 (patch) | |
tree | d83fa5cee912bd081b740a18e16f3ae008b0900b /vcl/unx/generic/glyphs/glyphcache.cxx | |
parent | 3deaeb9380d43d35cba82e1427492ca6ad0ea01f (diff) |
loplugin:useuniqueptr in GlyphCache
although I rather suspect these FreetypeFont objects would be better
held by rtl::Reference
Change-Id: I1a7d6ca47d1f78686637368a4bec57b1fcfaa6e9
Reviewed-on: https://gerrit.libreoffice.org/59020
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/unx/generic/glyphs/glyphcache.cxx')
-rw-r--r-- | vcl/unx/generic/glyphs/glyphcache.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/vcl/unx/generic/glyphs/glyphcache.cxx b/vcl/unx/generic/glyphs/glyphcache.cxx index e43b6db2e238..908f570a1c9d 100644 --- a/vcl/unx/generic/glyphs/glyphcache.cxx +++ b/vcl/unx/generic/glyphs/glyphcache.cxx @@ -50,12 +50,12 @@ GlyphCache::~GlyphCache() void GlyphCache::InvalidateAllGlyphs() { - for (auto const& font : maFontList) + for (auto& font : maFontList) { - FreetypeFont* pFreetypeFont = font.second; + FreetypeFont* pFreetypeFont = font.second.get(); // free all pFreetypeFont related data pFreetypeFont->GarbageCollect( mnLruIndex+0x10000000 ); - delete pFreetypeFont; + font.second.reset(); } maFontList.clear(); @@ -66,7 +66,7 @@ void GlyphCache::ClearFontOptions() { for (auto const& font : maFontList) { - FreetypeFont* pFreetypeFont = font.second; + FreetypeFont* pFreetypeFont = font.second.get(); // free demand-loaded FontConfig related data pFreetypeFont->ClearFontOptions(); } @@ -183,7 +183,7 @@ FreetypeFont* GlyphCache::CacheFont( const FontSelectPattern& rFontSelData ) FontList::iterator it = maFontList.find(rFontSelData); if( it != maFontList.end() ) { - FreetypeFont* pFound = it->second; + FreetypeFont* pFound = it->second.get(); assert(pFound); pFound->AddRef(); return pFound; @@ -196,7 +196,7 @@ FreetypeFont* GlyphCache::CacheFont( const FontSelectPattern& rFontSelData ) if( pNew ) { - maFontList[ rFontSelData ] = pNew; + maFontList[ rFontSelData ].reset(pNew); mnBytesUsed += pNew->GetByteCount(); // enable garbage collection for new font @@ -234,7 +234,7 @@ void GlyphCache::GarbageCollect() { FontList::iterator it = maFontList.begin(); if( it != maFontList.end() ) - mpCurrentGCFont = it->second; + mpCurrentGCFont = it->second.get(); } // unless there is no other font to collect |