From: Gunnar Sletta Date: Thu, 3 May 2012 13:48:53 +0000 (+0200) Subject: Keep polishing until there is nothing left to polish. X-Git-Tag: 071012131707~481 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=50523a21c960bb59405ec0ae0a9f313eefec5327;p=profile%2Fivi%2Fqtdeclarative.git Keep polishing until there is nothing left to polish. Some items will trigger changes in updatePolish() which again trigger property changes which needs polish to be executed again. If we do not polish until the set is fully cleared, we will end up with some items being in an unpolished state. To avoid polishing from going on indefinitely, we have a countdown that spits out a warning if polishing goes on forever. Change-Id: I4da6e884ca0d52b9b2701082ecf13e8c65508524 Reviewed-by: Aaron Kennedy --- diff --git a/src/quick/items/qquickcanvas.cpp b/src/quick/items/qquickcanvas.cpp index a6905b5..9a9a70b 100644 --- a/src/quick/items/qquickcanvas.cpp +++ b/src/quick/items/qquickcanvas.cpp @@ -211,14 +211,22 @@ void QQuickCanvas::focusInEvent(QFocusEvent *) void QQuickCanvasPrivate::polishItems() { - QSet itms = itemsToPolish; - itemsToPolish.clear(); + int maxPolishCycles = 100000; - for (QSet::iterator it = itms.begin(); it != itms.end(); ++it) { - QQuickItem *item = *it; - QQuickItemPrivate::get(item)->polishScheduled = false; - item->updatePolish(); + while (!itemsToPolish.isEmpty() && --maxPolishCycles > 0) { + QSet itms = itemsToPolish; + itemsToPolish.clear(); + + for (QSet::iterator it = itms.begin(); it != itms.end(); ++it) { + QQuickItem *item = *it; + QQuickItemPrivate::get(item)->polishScheduled = false; + item->updatePolish(); + } } + + if (maxPolishCycles == 0) + qWarning("QQuickCanvas: possible QQuickItem::polish() loop"); + updateFocusItemTransform(); }