Make FcDefaultFini() threadsafe
This commit is contained in:
parent
7019896c99
commit
32b0d88923
|
@ -107,14 +107,19 @@ retry:
|
||||||
void
|
void
|
||||||
FcDefaultFini (void)
|
FcDefaultFini (void)
|
||||||
{
|
{
|
||||||
if (default_lang) {
|
FcChar8 *lang;
|
||||||
free (default_lang);
|
FcStrSet *langs;
|
||||||
default_lang = NULL;
|
|
||||||
|
lang = fc_atomic_ptr_get (&default_lang);
|
||||||
|
if (lang && fc_atomic_ptr_cmpexch (&default_lang, lang, NULL)) {
|
||||||
|
free (lang);
|
||||||
}
|
}
|
||||||
if (default_langs) {
|
|
||||||
FcRefInit (&default_langs->ref, 1);
|
langs = fc_atomic_ptr_get (&default_langs);
|
||||||
FcStrSetDestroy (default_langs);
|
if (langs && fc_atomic_ptr_cmpexch (&default_langs, langs, NULL)) {
|
||||||
default_langs = NULL;
|
FcRefInit (&langs->ref, 1);
|
||||||
|
FcStrSetDestroy (langs);
|
||||||
|
langs = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue