Fix segfault.

This commit is contained in:
Patrick Lam 2005-11-29 00:21:05 +00:00
parent c4d3b6dad0
commit e0421d0289
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2005-11-28 Patrick Lam <plam@mit.edu>
* src/fccfg.c (FcConfigBuildFonts):
Fix segfault.
2005-11-28 Patrick Lam <plam@mit.edu> 2005-11-28 Patrick Lam <plam@mit.edu>
* src/fcint.h: * src/fcint.h:
* src/fcpat.c (FcPatternFindFullFname): * src/fcpat.c (FcPatternFindFullFname):

View File

@ -308,8 +308,11 @@ FcConfigBuildFonts (FcConfig *config)
for (i = 0; i < cached_fonts->nfont; i++) for (i = 0; i < cached_fonts->nfont; i++)
{ {
const char * cfn = (FcChar8 *)FcPatternFindFullFname
(cached_fonts->fonts[i]);
if (FcConfigAcceptFont (config, cached_fonts->fonts[i]) && if (FcConfigAcceptFont (config, cached_fonts->fonts[i]) &&
FcConfigAcceptFilename (config, (FcChar8 *)FcPatternFindFullFname(cached_fonts->fonts[i]))) (cfn && FcConfigAcceptFilename (config, cfn)))
FcFontSetAdd (fonts, cached_fonts->fonts[i]); FcFontSetAdd (fonts, cached_fonts->fonts[i]);
cached_fonts->fonts[i] = 0; /* prevent free in FcFontSetDestroy */ cached_fonts->fonts[i] = 0; /* prevent free in FcFontSetDestroy */