summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Reimer <manuel.reimer@gmx.de>2021-02-07 14:06:03 +0100
committerManuel Reimer <manuel.reimer@gmx.de>2021-02-07 14:07:34 +0100
commit206aa42eb56e5ee212d04be5706330d5fb62782d (patch)
tree2416d00eaf0a1fe04bd9d228b6794ba55a9536c7
parentd69d40234e17e69ac3fc63c02c4f168817f36621 (diff)
downloadgraphlcd-base-206aa42eb56e5ee212d04be5706330d5fb62782d.tar.gz
graphlcd-base-206aa42eb56e5ee212d04be5706330d5fb62782d.tar.bz2
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
-rw-r--r--glcdskin/font.c19
-rw-r--r--glcdskin/font.h2
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: