summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontdatabase.cpp
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2014-03-04 16:27:38 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-05 13:55:35 +0100
commit3fec94fd07f23dabfa23524d55028dc09cd1ddbb (patch)
tree106e8a4accf46cc8668fdcf899925a63181cc831 /src/gui/text/qfontdatabase.cpp
parent9f1089531d75b0a831e03c3a31ef8b4e5c0b54f4 (diff)
Prevent repeated and unnecessary font population QCoreTextFontDatabase
The platform font database is populated from QFontDatabase, through the static initializeDb() function, whenever the font database determines that the platform database has not been initialized (by checking if the font database is empty). There are other clients of QPlatformFontDatabase though, such as QFont, which uses the platform font database to check for the default family. The CoreText implementation of determining the default family relies on data that is computed during font population, and hence does an internal (self-triggered) populate. To prevent repeated populates as a result of calling QFont::defaultFamily() we guard the populate by a similar isEmpty() check as QFontDatabase does, but to ensure that this check works in the case of an invalidated font database, we need to propagate the font database invalidation down to the platform font database. Change-Id: I8d06c6f6fc5da6353c087335859eaca008c2f6a6 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/gui/text/qfontdatabase.cpp')
-rw-r--r--src/gui/text/qfontdatabase.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index b8ac7efb6c..fbb7fe02d6 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -420,6 +420,7 @@ void QFontDatabasePrivate::invalidate()
{
QFontCache::instance()->clear();
free();
+ QGuiApplicationPrivate::platformIntegration()->fontDatabase()->invalidate();
emit static_cast<QGuiApplication *>(QCoreApplication::instance())->fontDatabaseChanged();
}