diff options
author | Akira TAGOH <akira@tagoh.org> | 2020-03-23 14:03:47 +0900 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2020-03-23 14:08:55 +0900 |
commit | 6f6b39780215714386606ca1c5457a7106639ff4 (patch) | |
tree | cd1b2d4829e3d5a0f8a1f96c4e87f1fe51b0e4c1 | |
parent | 6def66164a36eed968aae872d76acfac3173d44a (diff) |
Fix assertion in FcCacheFini() again
The previous fix in fbc05949ef52c8a8d69233eed77f6636dffec280 was wrong. reverting.
When reading older caches, FcDirCacheMapHelper() returns FcFalse and
it became the return value from FcDirCacheProcess() too, which is wrong.
Actually one of calls for FcDirCacheMapHelper() should be successfully
finished and closure should have a valid pointer for cache.
Due to this, the proper finalization process wasn't running against
cache in closure.
Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/227
-rw-r--r-- | src/fccache.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/fccache.c b/src/fccache.c index 035458e..2d398c7 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -365,6 +365,7 @@ FcDirCacheProcess (FcConfig *config, const FcChar8 *dir, struct stat file_stat, dir_stat; FcBool ret = FcFalse; const FcChar8 *sysroot = FcConfigGetSysRoot (config); + struct timeval latest_mtime = (struct timeval){ 0 }; if (sysroot) d = FcStrBuildFilename (sysroot, dir, NULL); @@ -389,7 +390,6 @@ FcDirCacheProcess (FcConfig *config, const FcChar8 *dir, #ifndef _WIN32 FcBool retried = FcFalse; #endif - struct timeval latest_mtime = (struct timeval){ 0 }; if (sysroot) cache_hashed = FcStrBuildFilename (sysroot, cache_dir, cache_base, NULL); @@ -445,6 +445,8 @@ FcDirCacheProcess (FcConfig *config, const FcChar8 *dir, } FcStrListDone (list); + if (closure) + return !!(*((FcCache **)closure) != NULL); return ret; } @@ -792,7 +794,18 @@ FcCacheFini (void) int i; for (i = 0; i < FC_CACHE_MAX_LEVEL; i++) - assert (fcCacheChains[i] == NULL); + { + if (FcDebug() & FC_DBG_CACHE) + { + if (fcCacheChains[i] != NULL) + { + FcCacheSkip *s = fcCacheChains[i]; + printf("Fontconfig error: not freed %p (dir: %s, refcount %d)\n", s->cache, FcCacheDir(s->cache), s->ref.count); + } + } + else + assert (fcCacheChains[i] == NULL); + } assert (fcCacheMaxLevel == 0); free_lock (); |