Check if fontEngine is valid in QStaticText

When QuickWindow is set as setPersistentGraphics(false) and
setPersistentSceneGraph(false), texItems' fontEngines can
become invalid with hiding and showing.
In this case, a new font engine is created but not used.

Pick-to: 6.4 6.2
Fixes: QTBUG-108300
Change-Id: I2bd759724d78cecd62666beb6fb4a01f6063cae1
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Inho Lee 2022-11-16 09:29:41 +01:00
parent f32aa06f4f
commit b93720472e

View File

@ -5454,6 +5454,8 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText
if (font() != staticText_d->font || fp == nullptr || stfp == nullptr || fp->dpi != stfp->dpi) {
staticText_d->font = font();
staticText_d->needsRelayout = true;
} else if (stfp->engineData == nullptr || stfp->engineData->fontCacheId != QFontCache::instance()->id()) {
staticText_d->needsRelayout = true;
}
QFontEngine *fe = staticText_d->font.d->engineForScript(QChar::Script_Common);