fontconfig/backport-Report-more-detailed-logs-instead-of-assertion.patch
htpeng 4e014f14b8 backport Report more detailed logs by default instead of assertion
Signed-off-by: htpeng <htpengc@isoftstone.com>
(cherry picked from commit 9e967fa7c9cb956f7c645eb3630fe14834e6ec51)
2023-09-22 11:08:54 +08:00

80 lines
2.2 KiB
Diff

From ea2fe8840d084adebbbd93de162ae76f5fc5ef45 Mon Sep 17 00:00:00 2001
From: htpeng <htpengc@isoftstone.com>
Date: Thu, 31 Aug 2023 09:45:49 +0800
Subject: [PATCH] Report more detailed logs instead of assertion
Reference: https://gitlab.freedesktop.org/fontconfig/fontconfig/-/merge_requests/257
Signed-off-by: htpeng <htpengc@isoftstone.com>
---
src/fccache.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/src/fccache.c b/src/fccache.c
index b2392d3..b39cb0a 100644
--- a/src/fccache.c
+++ b/src/fccache.c
@@ -287,7 +287,7 @@ FcDirCacheUnlink (const FcChar8 *dir, FcConfig *config)
ret = FcFalse;
goto bail;
}
-
+
while ((cache_dir = FcStrListNext (list)))
{
if (sysroot)
@@ -381,7 +381,7 @@ FcDirCacheProcess (FcConfig *config, const FcChar8 *dir,
list = FcStrListCreate (config->cacheDirs);
if (!list)
return FcFalse;
-
+
while ((cache_dir = FcStrListNext (list)))
{
FcChar8 *cache_hashed;
@@ -793,20 +793,17 @@ FcCacheFini (void)
{
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)
{
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 ();
}
@@ -1018,7 +1015,7 @@ FcDirCacheMapFd (FcConfig *config, int fd, struct stat *fd_stat, struct stat *di
/* Mark allocated caches so they're freed rather than unmapped */
if (allocated)
cache->magic = FC_CACHE_MAGIC_ALLOC;
-
+
return cache;
}
@@ -1708,7 +1705,7 @@ FcCacheCopySet args1(const FcCache *c)
for (i = 0; i < old->nfont; i++)
{
FcPattern *font = FcFontSetFont (old, i);
-
+
FcPatternReference (font);
if (!FcFontSetAdd (new, font))
{
--
2.34.1