Reference patterns in FcCacheCopySet.

As patterns are put into the font set copy, mark them as referenced so the
cache stays around while the font set is in use.
This commit is contained in:
Keith Packard 2006-09-07 14:22:16 -07:00
parent 4c34c0c52a
commit 8d779ce4b3
1 changed files with 6 additions and 1 deletions

View File

@ -816,11 +816,16 @@ FcCacheCopySet args(const FcCache *c)
if (!new)
return NULL;
for (i = 0; i < old->nfont; i++)
if (!FcFontSetAdd (new, FcFontSetFont (old, i)))
{
FcPattern *font = FcFontSetFont (old, i);
FcPatternReference (font);
if (!FcFontSetAdd (new, font))
{
FcFontSetDestroy (new);
return NULL;
}
}
return new;
}