[Libreoffice-commits] .: 4 commits - vcl/source vcl/unx
Caolán McNamara
caolan at kemper.freedesktop.org
Thu Mar 10 05:39:14 PST 2011
vcl/source/fontsubset/sft.cxx | 2 --
vcl/source/glyphs/gcach_ftyp.cxx | 7 ++++---
vcl/source/glyphs/glyphcache.cxx | 8 +++++++-
vcl/unx/source/fontmanager/fontconfig.cxx | 2 +-
4 files changed, 12 insertions(+), 7 deletions(-)
New commits:
commit 525b6b30859ad5faf2f6c694a895b09a82c5100a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Mar 10 12:52:23 2011 +0000
fix leaks on bad ttf files
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 5cb6aa6..440794a 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1777,8 +1777,6 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t )
void CloseTTFont(TrueTypeFont *ttf) /*FOLD01*/
{
- if (ttf->tag != TTFontClassTag) return;
-
#if !defined(WIN32) && !defined(OS2)
if( ttf->fname )
munmap((char *) ttf->ptr, ttf->fsize);
commit f82a8f61c630030481293e7ae9872c1ca7ab57e0
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Mar 10 12:39:52 2011 +0000
remove memleak
diff --git a/vcl/source/glyphs/glyphcache.cxx b/vcl/source/glyphs/glyphcache.cxx
index a528244..8ad5a87 100644
--- a/vcl/source/glyphs/glyphcache.cxx
+++ b/vcl/source/glyphs/glyphcache.cxx
@@ -71,6 +71,12 @@ GlyphCache::GlyphCache( GlyphCachePeer& rPeer )
GlyphCache::~GlyphCache()
{
InvalidateAllGlyphs();
+ for( FontList::iterator it = maFontList.begin(), end = maFontList.end(); it != end; ++it )
+ {
+ ServerFont* pServerFont = it->second;
+ mrPeer.RemovingFont(*pServerFont);
+ delete pServerFont;
+ }
if( mpFtManager )
delete mpFtManager;
}
@@ -331,7 +337,7 @@ void GlyphCache::GarbageCollect()
pServerFont->GarbageCollect( mnLruIndex+0x10000000 );
if( pServerFont == mpCurrentGCFont )
mpCurrentGCFont = NULL;
- const ImplFontSelectData& rIFSD = pServerFont->GetFontSelData();
+ const ImplFontSelectData& rIFSD = pServerFont->GetFontSelData();
maFontList.erase( rIFSD );
mrPeer.RemovingFont( *pServerFont );
mnBytesUsed -= pServerFont->GetByteCount();
commit ef33edc9b8f02a163264e9e25e14b1430a8e345c
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Mar 10 12:27:29 2011 +0000
remove FtFontFile leaks
diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx
index ae44bed..b2e2f29 100644
--- a/vcl/source/glyphs/gcach_ftyp.cxx
+++ b/vcl/source/glyphs/gcach_ftyp.cxx
@@ -137,7 +137,7 @@ static bool bEnableSizeFT = false;
struct EqStr{ bool operator()(const char* a, const char* b) const { return !strcmp(a,b); } };
struct HashStr { size_t operator()( const char* s ) const { return rtl_str_hashCode(s); } };
-typedef ::boost::unordered_map<const char*,FtFontFile*,HashStr, EqStr> FontFileList;
+typedef ::boost::unordered_map<const char*,boost::shared_ptr<FtFontFile>,HashStr, EqStr> FontFileList;
namespace { struct vclFontFileList : public rtl::Static< FontFileList, vclFontFileList > {}; }
// -----------------------------------------------------------------------
@@ -212,12 +212,12 @@ FtFontFile* FtFontFile::FindFontFile( const ::rtl::OString& rNativeFileName )
FontFileList &rFontFileList = vclFontFileList::get();
FontFileList::const_iterator it = rFontFileList.find( pFileName );
if( it != rFontFileList.end() )
- return (*it).second;
+ return it->second.get();
// no => create new one
FtFontFile* pFontFile = new FtFontFile( rNativeFileName );
pFileName = pFontFile->maNativeFileName.getStr();
- rFontFileList[ pFileName ] = pFontFile;
+ rFontFileList[pFileName].reset(pFontFile);
return pFontFile;
}
commit c07828372a32f112a5e7e0131629c08e302a1104
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Mar 10 12:14:40 2011 +0000
release fonts on shutdown
diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx
index 828739c..ae44bed 100644
--- a/vcl/source/glyphs/gcach_ftyp.cxx
+++ b/vcl/source/glyphs/gcach_ftyp.cxx
@@ -522,6 +522,7 @@ void* FreetypeServerFont::GetFtFace() const
FreetypeManager::~FreetypeManager()
{
+ ClearFontList();
// This crashes on Solaris 10
// TODO: check which versions have this problem
//
diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx
index 7a40084..0dd5260 100644
--- a/vcl/unx/source/fontmanager/fontconfig.cxx
+++ b/vcl/unx/source/fontmanager/fontconfig.cxx
@@ -162,7 +162,7 @@ public:
void FcFini()
{
- //To-Do: get non-headless mode smoketest to pass
+ //To-Do: get gtk vclplug smoketest to pass
//if (m_pFcFini) m_pFcFini();
}
More information about the Libreoffice-commits
mailing list