![]() |
Qt 6.x
The Qt SDK
|
Public Member Functions | |
PolishLoopDetector (const QVector< QQuickItem * > &itemsToPolish) | |
bool | check (QQuickItem *item, int itemsRemainingBeforeUpdatePolish) |
Public Attributes | |
const QVector< QQuickItem * > & | itemsToPolish |
int | numPolishLoopsInSequence = 0 |
A "polish loop" can occur inside QQuickWindowPrivate::polishItems(). It is when an item calls polish() on an(other?) item from updatePolish(). If this anomaly happens repeatedly and without interruption (of a well-behaved updatePolish() that doesn't call polish()), it is a strong indication that we are heading towards an infinite polish loop. A polish loop is not a bug in Qt Quick - it is a bug caused by ill-behaved items put in the scene.
We can detect this sequence of polish loops easily, since the QQuickWindowPrivate::itemsToPolish is basically a stack: polish() will push to it, and polishItems() will pop from it. Therefore if updatePolish() calls polish(), the immediate next item polishItems() processes is the item that was polished by the previous call to updatePolish(). We therefore just need to count the number of polish loops we detected in sequence.
Definition at line 272 of file qquickwindow.cpp.
|
inline |
Definition at line 274 of file qquickwindow.cpp.
|
inline |
Definition at line 283 of file qquickwindow.cpp.
References QLatin1StringView::arg(), QString::isNull(), item, itemsToPolish, numPolishLoopsInSequence, QQmlMetaType::prettyTypeName(), qmlWarning(), and typeName.
Referenced by QQuickWindowPrivate::polishItems().
const QVector<QQuickItem*>& PolishLoopDetector::itemsToPolish |
Definition at line 325 of file qquickwindow.cpp.
Referenced by check().
int PolishLoopDetector::numPolishLoopsInSequence = 0 |
Definition at line 326 of file qquickwindow.cpp.
Referenced by check().