From 49b44b277f2a8a67009a3b68b178b2f1a4c7f72a Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 9 Sep 2006 16:41:58 -0700 Subject: [PATCH] Insert newly created caches into reference data structure. All caches used in the application must be in the cache reference list so internal references can be tracked correctly. Failing to have newly created caches in the list would cause the cache to be deallocated while references were still present. --- src/fccache.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/fccache.c b/src/fccache.c index 11f88a7..e289c5d 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -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: -- 2.39.5