From 206aa42eb56e5ee212d04be5706330d5fb62782d Mon Sep 17 00:00:00 2001 From: Manuel Reimer Date: Sun, 7 Feb 2021 14:06:03 +0100 Subject: Remove usage of FcFini() - Calling FcFini() makes us prone to race conditions with other libraries - Calling FcInit() multiple times is fine. There is no need to limit this --- glcdskin/font.c | 19 ++----------------- glcdskin/font.h | 2 -- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/glcdskin/font.c b/glcdskin/font.c index bffdfe6..e9ee36b 100644 --- a/glcdskin/font.c +++ b/glcdskin/font.c @@ -13,8 +13,6 @@ namespace GLCD { -int cSkinFont::FcInitCount = 0; - cSkinFont::cSkinFont(cSkin * Parent) : mSkin(Parent), @@ -25,12 +23,6 @@ cSkinFont::cSkinFont(cSkin * Parent) } cSkinFont::~cSkinFont(void) { -#ifdef HAVE_FONTCONFIG - cSkinFont::FcInitCount --; - if (cSkinFont::FcInitCount <= 0) { - FcFini(); - } -#endif } bool cSkinFont::FileExists(const std::string& path) @@ -96,10 +88,7 @@ bool cSkinFont::ParseUrl(const std::string & url) return false; } - if (cSkinFont::FcInitCount <= 0) { - FcInit(); - } - cSkinFont::FcInitCount ++; + FcInit(); FcPattern *pat = FcNameParse((FcChar8 *) rawfont.c_str() ); rawfont = ""; @@ -165,11 +154,7 @@ bool cSkinFont::ParseUrl(const std::string & url) // all system default font directories if (!FileExists(mFile)) { - if (cSkinFont::FcInitCount <= 0) - { - FcInit(); - } - cSkinFont::FcInitCount++; + FcInit(); FcStrList* dirlist = FcConfigGetFontDirs(NULL); FcChar8* dir; diff --git a/glcdskin/font.h b/glcdskin/font.h index 3813e6e..3f09c20 100644 --- a/glcdskin/font.h +++ b/glcdskin/font.h @@ -49,8 +49,6 @@ private: cSkinDisplay mDummyDisplay; cSkinObject mDummyObject; - static int FcInitCount; - bool FileExists(const std::string& path); public: -- cgit v1.2.3