|
最近发现fontconfig中有个BUG导致打开KDE控制中心字体安装程序异常退出。
BUG在 fontconfig-2.2.3/src/fccfg.c中
void
FcConfigAppFontClear (FcConfig *config)
{
FcConfigSetFonts (config, 0, FcSetApplication);
}
void
FcConfigSetFonts (FcConfig *config,
FcFontSet *fonts,
FcSetName set)
{
if (config->fonts[set])
FcFontSetDestroy (config->fonts[set]);
/*---------------------------------------------------------*/
/* Add by Firefly([email protected]) */
#define ST_ITALIC 0
#define ST_BOLD 1
#define ST_BOLD_ITALIC 2
FcBool scalable;
FcPattern *pat;
FcChar8 *family;
int slant, weight;
int f;
for (f = 0; f < fonts->nfont; f++) //BUG: FcConfigSetFonts (config, 0, FcSetApplication); 这里 fonts为0 空指针错误!
{
.......
};
解决方法:
void
FcConfigSetFonts (FcConfig *config,
FcFontSet *fonts,
FcSetName set)
{
if (config->fonts[set])
FcFontSetDestroy (config->fonts[set]);
/*---------------------------------------------------------*/
/* Add by Firefly([email protected]) */
#define ST_ITALIC 0
#define ST_BOLD 1
#define ST_BOLD_ITALIC 2
FcBool scalable;
FcPattern *pat;
FcChar8 *family;
int slant, weight;
int f;
if (fonts == 0) { //在这里加fonts值的判断
config->fonts[set] = fonts;
return;
}
for (f = 0; f < fonts->nfont; f++)
{
.......
}; |
|