summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorBernd Weimer <bweimer@rim.com>2013-02-14 09:38:37 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-19 16:45:43 (GMT)
commit6ecf8502fe49ad50689635f7d7bc0215986ba76c (patch)
tree680dcf3ff0e561d5c4b4b4f5a271ed76634e553d /src/plugins
parent0b83e9e665ec410610289242a821d55e445c8506 (diff)
downloadQt-6ecf8502fe49ad50689635f7d7bc0215986ba76c.zip
Qt-6ecf8502fe49ad50689635f7d7bc0215986ba76c.tar.gz
Qt-6ecf8502fe49ad50689635f7d7bc0215986ba76c.tar.bz2
Fixed some issues in QFontconfigDatabase::fallbacksForFamily
In FcFontSort() the result parameter is not set in older fontconfig versions (<=2.9.0), so this parameter is ignored. Some fontconfig objects are destroyed after usage to avoid memory leaks. This is basically a backport from Qt5. Change-Id: I557dbd5d7303cbd98becf169ebaa754e5d99c281 Reviewed-by: Wolfgang Bremer <wbremer@rim.com> Reviewed-by: Jiang Jiang <gzjjgod@gmail.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp
index 665fa3c..656a247 100644
--- a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp
+++ b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp
@@ -576,12 +576,13 @@ QStringList QFontconfigDatabase::fallbacksForFamily(const QString family, const
}
FcConfigSubstitute(0, pattern, FcMatchPattern);
- FcConfigSubstitute(0, pattern, FcMatchFont);
+ FcDefaultSubstitute(pattern);
FcResult result = FcResultMatch;
FcFontSet *fontSet = FcFontSort(0,pattern,FcFalse,0,&result);
+ FcPatternDestroy(pattern);
- if (fontSet && result == FcResultMatch)
+ if (fontSet)
{
for (int i = 0; i < fontSet->nfont; i++) {
FcChar8 *value = 0;
@@ -592,8 +593,8 @@ QStringList QFontconfigDatabase::fallbacksForFamily(const QString family, const
if (!fallbackFamilies.contains(familyName,Qt::CaseInsensitive)) {
fallbackFamilies << familyName;
}
-
}
+ FcFontSetDestroy(fontSet);
}
// qDebug() << "fallbackFamilies for:" << family << fallbackFamilies;