]> git.wh0rd.org - fontconfig.git/blobdiff - src/fccache.c
Insert newly created caches into reference data structure.
[fontconfig.git] / src / fccache.c
index e4b04fcae7622c47196710d88160d6269431ca4b..e289c5dd89bd3f8a400a21fb8edacfa0645d42d2 100644 (file)
@@ -275,9 +275,18 @@ FcCacheInsert (FcCache *cache, struct stat *cache_stat)
     s->cache = cache;
     s->size = cache->size;
     s->ref = 1;
-    s->cache_dev = cache_stat->st_dev;
-    s->cache_ino = cache_stat->st_ino;
-    s->cache_mtime = cache_stat->st_mtime;
+    if (cache_stat)
+    {
+       s->cache_dev = cache_stat->st_dev;
+       s->cache_ino = cache_stat->st_ino;
+       s->cache_mtime = cache_stat->st_mtime;
+    }
+    else
+    {
+       s->cache_dev = 0;
+       s->cache_ino = 0;
+       s->cache_mtime = 0;
+    }
     
     /*
      * Insert into all fcCacheChains
@@ -658,6 +667,8 @@ FcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, FcStrSet *dirs)
 
     FcSerializeDestroy (serialize);
     
+    FcCacheInsert (cache, NULL);
+
     return cache;
 
 bail2:
@@ -816,11 +827,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;
 }