QFontDatabase: Clear font cache before emitting fontDatabaseChanged

Matches the ordering in QFontDatabasePrivate::invalidate() and ensures
that when the fontDatabaseChanged signal is processed by clients the
cache is ready to be filled again.

Change-Id: I9d09060284c6090ae2748147f6ee75b9f9b173c5
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
bb10
Tor Arne Vestbø 2022-04-04 15:51:50 +02:00
parent 4ec9b0cd19
commit d42ad7b01e
1 changed files with 2 additions and 2 deletions

View File

@ -2188,12 +2188,12 @@ int QFontDatabasePrivate::addAppFont(const QByteArray &fontData, const QString &
applicationFonts[i] = font;
emit qApp->fontDatabaseChanged();
// The font cache may have cached lookups for the font that was now
// loaded, so it has to be flushed.
QFontCache::instance()->clear();
emit qApp->fontDatabaseChanged();
return i;
}