From d42ad7b01e4d9b9fd097db5c438e7f646ef49b1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 4 Apr 2022 15:51:50 +0200 Subject: [PATCH] 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 --- src/gui/text/qfontdatabase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 5d72a7b909..00e4567472 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -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; }