From a068f2d7c9967b6e12eaf8453760d462cbce40db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 21 Mar 2022 14:21:10 +0100 Subject: [PATCH] CoreText: Add note about why we defer population of theme font descriptors Pick-to: 6.2 6.3 Change-Id: I7018a92467c6db1b9d04b88e50113ba9c9d1a3b7 Reviewed-by: Timur Pocheptsov --- src/gui/text/coretext/qcoretextfontdatabase.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/text/coretext/qcoretextfontdatabase.mm b/src/gui/text/coretext/qcoretextfontdatabase.mm index a49f85e90c..47af17b04b 100644 --- a/src/gui/text/coretext/qcoretextfontdatabase.mm +++ b/src/gui/text/coretext/qcoretextfontdatabase.mm @@ -764,6 +764,12 @@ void QCoreTextFontDatabase::populateThemeFonts() FontDescription fd; getFontDescription(fontDescriptor, &fd); + // We might get here from QFontDatabase::systemFont() or QPlatformTheme::font(), + // before the font database has initialized itself and populated all available + // families. As a result, we can't populate the descriptor at this time, as that + // would result in the font database having > 0 families, which would result in + // skipping the initialization and population of all other font families. Instead + // we store the descriptors for later and populate them during populateFontDatabase(). if (!m_systemFontDescriptors.contains(fontDescriptor)) m_systemFontDescriptors.insert(fontDescriptor); else