Avoid modifying cacheCount while iterating over it
authorAlan Alpert <aalpert@blackberry.com>
Fri, 12 Apr 2013 17:30:51 +0000 (10:30 -0700)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 26 Apr 2013 19:17:42 +0000 (21:17 +0200)
commit8563adb737cec5d440197ddbd514fe201c5f18ff
tree999d3a48e23b0c5c42ae2d793a86d6a01bef8f76
parent0bcf549647082e3a80768e2ea5336abf420d042d
Avoid modifying cacheCount while iterating over it

Because the cache items can be referenced in bindings, the last ref for
the item can be cleared at any time due to JS ownership. This could
modify the cache count while iterating over it. The removal from the
cache list is now postponed until iteration is finished. All iteration
cases can already handle an invalid cache item being found in the list.

Task-number: QTBUG-30555
Change-Id: I1c0721b4d7e0dd69ce7a73824c1aa7b50d2c32a2
Reviewed-by: Albert Astals Cid <albert.astals@canonical.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/types/qqmldelegatemodel.cpp