From e5cb4fc10f104eea433a08087c7d91b97c74dc7c Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Wed, 12 Sep 2007 19:07:22 +0000 Subject: [PATCH] Fix crash with old versions (earlier than 2.2.92) of fontconfig. * src/frontends/qt4/GuiFontLoader.{cpp,h} (GuiFontLoader::GuiFontLoader): don't store font IDs anymore, as we are not going to clean up after ourselves. (GuiFontLoader::~GuiFontLoader): make it virtual again and do nothing (avoids a crash with fontconfig < 2.2.92). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20246 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiFontLoader.cpp | 19 ++----------------- src/frontends/qt4/GuiFontLoader.h | 5 +---- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/src/frontends/qt4/GuiFontLoader.cpp b/src/frontends/qt4/GuiFontLoader.cpp index 63ef2c0068..df6e7543e7 100644 --- a/src/frontends/qt4/GuiFontLoader.cpp +++ b/src/frontends/qt4/GuiFontLoader.cpp @@ -196,19 +196,17 @@ pair const getSymbolFont(string const & family) GuiFontLoader::GuiFontLoader() { #if QT_VERSION >= 0x040200 - fontID = new int[num_math_fonts]; - string const fonts_dir = addPath(package().system_support().absFilename(), "fonts"); for (int i = 0 ; i < num_math_fonts; ++i) { string const font_file = lyx::support::os::external_path( addName(fonts_dir, math_fonts[i] + ".ttf")); - fontID[i] = QFontDatabase::addApplicationFont(toqstr(font_file)); + int fontID = QFontDatabase::addApplicationFont(toqstr(font_file)); LYXERR(Debug::FONT) << "Adding font " << font_file << static_cast - (fontID[i] < 0 ? " FAIL" : " OK") + (fontID < 0 ? " FAIL" : " OK") << endl; } #endif @@ -221,19 +219,6 @@ GuiFontLoader::GuiFontLoader() } -GuiFontLoader::~GuiFontLoader() -{ -#if QT_VERSION >= 0x040200 - for (int i = 0 ; i < num_math_fonts; ++i) { - if (fontID[i] >= 0) - QFontDatabase::removeApplicationFont(fontID[i]); - } - - delete [] fontID; -#endif -} - - void GuiFontLoader::update() { for (int i1 = 0; i1 < Font::NUM_FAMILIES; ++i1) { diff --git a/src/frontends/qt4/GuiFontLoader.h b/src/frontends/qt4/GuiFontLoader.h index 7329cc2ac2..5fc718fbbf 100644 --- a/src/frontends/qt4/GuiFontLoader.h +++ b/src/frontends/qt4/GuiFontLoader.h @@ -48,7 +48,7 @@ public: GuiFontLoader(); /// Destructor - ~GuiFontLoader(); + virtual ~GuiFontLoader() {} virtual void update(); virtual bool available(Font const & f); @@ -74,9 +74,6 @@ public: } private: -#if QT_VERSION >= 0x040200 - int * fontID; -#endif /// BUTT ugly ! QLFontInfo * fontinfo_[Font::NUM_FAMILIES][2][4][10]; }; -- 2.39.5