Fix crash when QQuickWindow::updatePolish() deletes QQuickItems.
authorGunnar Sletta <gunnar.sletta@jollamobile.com>
Thu, 5 Feb 2015 11:00:00 +0000 (12:00 +0100)
committerGunnar Sletta <gunnar@sletta.org>
Fri, 6 Feb 2015 07:02:51 +0000 (07:02 +0000)
commit0b60867f80e207a9ccc27cc337116d1c6fc928bd
tree26d56168203d71613ce50a166ef1a47c80089911
parent566b23df8c31b50fc514a069564d23121d0f4ef9
Fix crash when QQuickWindow::updatePolish() deletes QQuickItems.

When an item is deleted as a result of an updatePolish() call, it will
be removed from the itemsToPolish set. However, updatePolish()
internally works on a copy of the itemsToPolish set because changes to
the set would invalidate its iterator. Because it is a copy will still
contain the deleted item.

Fix this by simplifying the algorithm to instead pick items one by
one from the itemsToPolish set until it is empty. The recursion guard
has been increased because we're not decrementing it for every single
QQuickItem::updatePolish() call.

Task-number: QTBUG-42913
Change-Id: If7ab7f7616b01daf4d3ed843f927c163dfb03843
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
src/quick/items/qquickwindow.cpp