From: Keith Packard Date: Thu, 7 Sep 2006 21:22:16 +0000 (-0700) Subject: Reference patterns in FcCacheCopySet. X-Git-Tag: 2.4.0~13 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=8d779ce4b3cdac796e20ca568654c0ef1c576809;p=fontconfig.git 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. --- diff --git a/src/fccache.c b/src/fccache.c index e4b04fc..11f88a7 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -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; }