Report more detailed logs instead of assertion.

Getting backtraces against this assertion isn't useful at all.
Fontconfig isn't capable to report who really have a reference
of caches though, this report may be better than assertion.
So we can try analysis tools then.
And report it only when running with FC_DEBUG=16.
This commit is contained in:
Akira TAGOH 2023-01-25 11:50:29 +09:00
parent 50c55e95f4
commit e3d9ad280a
1 changed files with 7 additions and 10 deletions

View File

@ -794,20 +794,17 @@ FcCacheFini (void)
{ {
int i; int i;
for (i = 0; i < FC_CACHE_MAX_LEVEL; i++) if (FcDebug() & FC_DBG_CACHE)
{ {
if (FcDebug() & FC_DBG_CACHE) for (i = 0; i < FC_CACHE_MAX_LEVEL; i++)
{ {
if (fcCacheChains[i] != NULL) if (fcCacheChains[i] != NULL)
{ {
FcCacheSkip *s = fcCacheChains[i]; FcCacheSkip *s = fcCacheChains[i];
printf("Fontconfig error: not freed %p (dir: %s, refcount %" FC_ATOMIC_INT_FORMAT ")\n", s->cache, FcCacheDir(s->cache), s->ref.count); fprintf(stderr, "Fontconfig error: not freed %p (dir: %s, refcount %" FC_ATOMIC_INT_FORMAT ")\n", s->cache, FcCacheDir(s->cache), s->ref.count);
} }
} }
else
assert (fcCacheChains[i] == NULL);
} }
assert (fcCacheMaxLevel == 0);
free_lock (); free_lock ();
} }