fontconfig: Branch 'main' - 6 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed May 28 10:42:43 UTC 2025
src/fccfg.c | 22 ++++++++--------------
src/fcdefault.c | 4 ++++
test/test-crbug1004254.c | 8 +++-----
3 files changed, 15 insertions(+), 19 deletions(-)
New commits:
commit e2dea58dfb19d8233183bff0974cc47acd4c8b7a
Merge: 3d7105d 3ad3516
Author: Akira TAGOH <akira at tagoh.org>
Date: Wed May 28 10:42:38 2025 +0000
Merge branch 'simplify-fcconfigfini' into 'main'
Simplify FcConfigFini()
See merge request fontconfig/fontconfig!414
commit 3ad35163ed8d92e3b12cf316bd204d6d4b3c019c
Author: Akira TAGOH <akira at tagoh.org>
Date: Wed May 28 18:59:28 2025 +0900
Avoid possibly invalid access on MT
diff --git a/src/fcdefault.c b/src/fcdefault.c
index f742fc1..3fd6ccc 100644
--- a/src/fcdefault.c
+++ b/src/fcdefault.c
@@ -295,6 +295,8 @@ FcConfigSetDefaultSubstitute (FcConfig *config,
int i;
double dpi, size, scale, pixelsize;
+ config = FcConfigReference (config);
+
if (!FcPatternFindObjectIter (pattern, &iter, FC_WEIGHT_OBJECT))
FcPatternObjectAddInteger (pattern, FC_WEIGHT_OBJECT, FC_WEIGHT_NORMAL);
@@ -391,6 +393,8 @@ FcConfigSetDefaultSubstitute (FcConfig *config,
if (!FcPatternFindObjectIter (pattern, &iter, FC_ORDER_OBJECT))
FcPatternObjectAddInteger (pattern, FC_ORDER_OBJECT, 0);
+
+ FcConfigDestroy (config);
}
void
commit 2e7a9789590c2c9a1fe4b040beb5128d87203689
Author: Akira TAGOH <akira at tagoh.org>
Date: Wed May 28 17:13:28 2025 +0900
Fix a memory leak in default_langs
diff --git a/src/fccfg.c b/src/fccfg.c
index 913a8b3..d87a627 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -400,8 +400,10 @@ FcConfigDestroy (FcConfig *config)
if (config->default_lang)
FcStrFree (config->default_lang);
- if (config->default_langs)
+ if (config->default_langs) {
+ FcRefInit (&config->default_langs->ref, 1);
FcStrSetDestroy (config->default_langs);
+ }
if (config->prgname)
FcStrFree (config->prgname);
if (config->desktop_name)
commit e7ed8d6dbf3b1b7941609664f88c61e7d4b71eca
Author: Akira TAGOH <akira at tagoh.org>
Date: Wed May 28 15:13:40 2025 +0900
Call FcMutexUnlock only when valid instance is available
diff --git a/src/fccfg.c b/src/fccfg.c
index 8039912..913a8b3 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -70,7 +70,8 @@ unlock_config (void)
{
FcMutex *lock;
lock = fc_atomic_ptr_get (&_lock);
- FcMutexUnlock (lock);
+ if (lock)
+ FcMutexUnlock (lock);
}
static void
commit 9a69e2e346ad6f2bc210777e83143a84db914693
Author: Akira TAGOH <akira at tagoh.org>
Date: Wed May 28 14:26:00 2025 +0900
Revert "test-crbug1004254: hold FcConfig during running a test in a thread"
This reverts commit 605e3a2ea15064759ac6fd72ee9ce92c139cb80e.
diff --git a/test/test-crbug1004254.c b/test/test-crbug1004254.c
index be332b1..e14c2a4 100644
--- a/test/test-crbug1004254.c
+++ b/test/test-crbug1004254.c
@@ -38,20 +38,18 @@ run_query (void)
{
FcPattern *pat = FcPatternCreate(), *match;
FcResult result;
- FcConfig *config = FcConfigReference (FcConfigGetCurrent());
FcPatternAddString (pat, FC_FAMILY, (const FcChar8 *)"sans-serif");
FcPatternAddBool (pat, FC_SCALABLE, FcTrue);
- FcConfigSubstitute (config, pat, FcMatchPattern);
- FcConfigSetDefaultSubstitute (config, pat);
- match = FcFontMatch (config, pat, &result);
+ FcConfigSubstitute (NULL, pat, FcMatchPattern);
+ FcConfigSetDefaultSubstitute (NULL, pat);
+ match = FcFontMatch (NULL, pat, &result);
if (result != FcResultMatch || !match) {
fprintf (stderr, "ERROR: No matches found\n");
}
if (match)
FcPatternDestroy (match);
FcPatternDestroy (pat);
- FcConfigDestroy (config);
}
static void
commit 8bc7ccb0f74943e3aa37d8a7f26c5b8950308920
Author: Akira TAGOH <akira at tagoh.org>
Date: Wed May 28 13:56:29 2025 +0900
Simplify FcConfigFini()
No need to take a look at the reference counter here
because the pointer exchange between default instance
and targeted instance is done in FcConfigDestroy().
diff --git a/src/fccfg.c b/src/fccfg.c
index 0d3d573..8039912 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -131,19 +131,10 @@ FcConfigFini (void)
{
FcConfig *cfg;
-retry:
+ FcConfigDestroy (_fcConfig);
cfg = fc_atomic_ptr_get (&_fcConfig);
- if (cfg) {
- if (cfg->ref.count > 1)
- FcConfigDestroy (cfg);
- else {
- if (fc_atomic_ptr_cmpexch (&_fcConfig, cfg, NULL))
- FcConfigDestroy (cfg);
- else
- goto retry;
- free_lock();
- }
- }
+ if (!cfg)
+ free_lock();
}
FcConfig *
More information about the Fontconfig
mailing list