Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
PolishLoopDetector Struct Reference
+ Collaboration diagram for PolishLoopDetector:

Public Member Functions

 PolishLoopDetector (const QVector< QQuickItem * > &itemsToPolish)
 
bool check (QQuickItem *item, int itemsRemainingBeforeUpdatePolish)
 

Public Attributes

const QVector< QQuickItem * > & itemsToPolish
 
int numPolishLoopsInSequence = 0
 

Detailed Description

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 279 of file qquickwindow.cpp.

Constructor & Destructor Documentation

◆ PolishLoopDetector()

PolishLoopDetector::PolishLoopDetector ( const QVector< QQuickItem * > & itemsToPolish)
inline

Definition at line 281 of file qquickwindow.cpp.

Member Function Documentation

◆ check()

bool PolishLoopDetector::check ( QQuickItem * item,
int itemsRemainingBeforeUpdatePolish )
inline

Definition at line 290 of file qquickwindow.cpp.

References QLatin1StringView::arg(), item, itemsToPolish, numPolishLoopsInSequence, QQmlMetaType::prettyTypeName(), qmlWarning(), and typeName.

+ Here is the call graph for this function:

Member Data Documentation

◆ itemsToPolish

const QVector<QQuickItem*>& PolishLoopDetector::itemsToPolish

Definition at line 332 of file qquickwindow.cpp.

Referenced by check().

◆ numPolishLoopsInSequence

int PolishLoopDetector::numPolishLoopsInSequence = 0

Definition at line 333 of file qquickwindow.cpp.

Referenced by check().


The documentation for this struct was generated from the following file: