Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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)
 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 278 of file qquickwindow.cpp.

Constructor & Destructor Documentation

◆ PolishLoopDetector() [1/2]

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

Definition at line 280 of file qquickwindow.cpp.

References PolishLoopDetector().

Referenced by PolishLoopDetector().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PolishLoopDetector() [2/2]

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

Definition at line 280 of file qquickwindow.cpp.

Member Function Documentation

◆ check() [1/2]

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

Definition at line 289 of file qquickwindow.cpp.

References numPolishLoopsInSequence.

◆ check() [2/2]

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

Definition at line 289 of file qquickwindow.cpp.

Member Data Documentation

◆ itemsToPolish

const QVector< QQuickItem * > & PolishLoopDetector::itemsToPolish

Definition at line 325 of file qquickwindow.cpp.

◆ numPolishLoopsInSequence

int PolishLoopDetector::numPolishLoopsInSequence = 0

Definition at line 326 of file qquickwindow.cpp.

Referenced by check().


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