]> git.wh0rd.org - fontconfig.git/commitdiff
Reference patterns in FcCacheCopySet.
authorKeith Packard <keithp@neko.keithp.com>
Thu, 7 Sep 2006 21:22:16 +0000 (14:22 -0700)
committerKeith Packard <keithp@neko.keithp.com>
Thu, 7 Sep 2006 21:22:16 +0000 (14:22 -0700)
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.

src/fccache.c

index e4b04fcae7622c47196710d88160d6269431ca4b..11f88a788b2dc84ab5361055aac44f638924ffd7 100644 (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;
 }