QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2582|回复: 1

最近发现fontconfig(firefly)中有个BUG

[复制链接]
发表于 2005-4-30 14:39:18 | 显示全部楼层 |阅读模式
最近发现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++)
{

.......
};
发表于 2005-4-30 16:21:02 | 显示全部楼层
看到指针偶先去晕一会儿
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-4-19 19:07 , Processed in 0.073567 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表