From 532b3c3ab86b7ffea5da71a9048b95ab43862e05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Arve=20S=C3=A6ther?= Date: Tue, 22 Jun 2021 14:35:25 +0200 Subject: Native style: Do not assert When a component (e.g. Button) is used as a delegate in ListView, we might get a updatePolish() before the component is completed. Make sure we don't call polish() before we are completed. Fixes: QTBUG-93041 Change-Id: Iba5d1a4365c864f8ff8115383880500feac7bc5d Reviewed-by: Mitch Curtis (cherry picked from commit 0c2adb5652480f7546fadb78b652a09294c4e646) Reviewed-by: Qt Cherry-pick Bot --- src/quicknativestyle/items/qquickstyleitem.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/quicknativestyle/items/qquickstyleitem.cpp b/src/quicknativestyle/items/qquickstyleitem.cpp index 23f290d3..ec041d01 100644 --- a/src/quicknativestyle/items/qquickstyleitem.cpp +++ b/src/quicknativestyle/items/qquickstyleitem.cpp @@ -124,13 +124,15 @@ void QQuickStyleItem::connectToControl() const void QQuickStyleItem::markImageDirty() { m_dirty.setFlag(DirtyFlag::Image); - polish(); + if (isComponentComplete()) + polish(); } void QQuickStyleItem::markGeometryDirty() { m_dirty.setFlag(DirtyFlag::Geometry); - polish(); + if (isComponentComplete()) + polish(); } QSGNode *QQuickStyleItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *) -- cgit v1.2.3