posix: Resolved issue with leaks in FontFc

git-svn-id: svn://ultimatepp.org/upp/trunk@8807 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2015-08-09 17:25:43 +00:00
parent e53bdf2fb2
commit f56063246d
3 changed files with 5 additions and 15 deletions

View file

@ -332,7 +332,7 @@ EXITBLOCK {
if(bigstat) {
total += bigstat;
VppLog() << Sprintf(">64KB %8dx %2d%%, total %8dx %2d%%\n",
bigstat, 100 * bigstat / sum, total, 100 * total / sum);
bigstat, 100 * bigstat / sum, total, 100 * total / sum);
}
}
#endif

View file

@ -149,8 +149,6 @@ void ChHostSkin()
Font::SetDefaultFont(Font(fontname, (fontheight * xdpi + 512*72) / (1024*72))
.Bold(bold).Italic(italic));
ClearFtFaceCache();
ColoredOverride(CtrlsImg::Iml(), CtrlsImg::Iml());
int classiq = engine == "Redmond" || engine == "Raleigh" || engine == "Glider" || engine == "Simple";
@ -698,8 +696,6 @@ void ChHostSkin()
GUI_AltAccessKeys_Write(1);
GUI_AKD_Conservative_Write(0);
ClearFtFaceCache();
CurrentSoundTheme = GtkStyleString("gtk-sound-theme-name");
}

View file

@ -17,7 +17,7 @@ NAMESPACE_UPP
static FT_Library sFTlib;
EXITBLOCK
EXITBLOCK
{
if(sFTlib)
FT_Done_FreeType(sFTlib);
@ -89,14 +89,6 @@ struct FtFaceEntry {
String path;
};
static FtFaceEntry ft_cache[FONTCACHE];
void ClearFtFaceCache()
{
for(int i = 0; i < FONTCACHE; i++)
ft_cache[i].font.Height(-30000);
}
FT_Face (*FTFaceXft)(Font fnt, String *rpath);
FT_Face FTFace(Font fnt, String *rpath = NULL)
@ -104,8 +96,10 @@ FT_Face FTFace(Font fnt, String *rpath = NULL)
LTIMING("FTFace");
if(FTFaceXft)
return (*FTFaceXft)(fnt, rpath);
static FtFaceEntry ft_cache[FONTCACHE];
ONCELOCK {
ClearFtFaceCache();
for(int i = 0; i < FONTCACHE; i++)
ft_cache[i].font.Height(-30000);
}
FtFaceEntry be;
be = ft_cache[0];