┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2014-03-11 09:07:23 +0100
committerFrank Reininghaus <[email protected]>2014-03-11 09:07:23 +0100
commit773d505493773575df933babbf46eacc8f85316f (patch)
tree131faad02fb2587b3f0f3429168b86d70c2c5324 /src
parent6747241934218c6e7529e94598d1f16cb87951ff (diff)
Use QMutableHashIterator for deleting items from a QHash
KItemListViewAnimation::slotFinished() used a QHashIterator to iterate over a QHash, and then removes an item from the hash using QHash::remove() inside the loop. This is quite unusual - the recommended way is to use a QMutableHashIterator (or std-style iterators and then QHash::erase(it)). This might be related to the cause of a crash in this function. BUG: 331876 REVIEW: 116666 FIXED-IN: 4.13.0
Diffstat (limited to 'src')
-rw-r--r--src/kitemviews/private/kitemlistviewanimation.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/kitemviews/private/kitemlistviewanimation.cpp b/src/kitemviews/private/kitemlistviewanimation.cpp
index e347c5bb1..5a00c8c3a 100644
--- a/src/kitemviews/private/kitemlistviewanimation.cpp
+++ b/src/kitemviews/private/kitemlistviewanimation.cpp
@@ -225,13 +225,13 @@ void KItemListViewAnimation::slotFinished()
{
QPropertyAnimation* finishedAnim = qobject_cast<QPropertyAnimation*>(sender());
for (int type = 0; type < AnimationTypeCount; ++type) {
- QHashIterator<QGraphicsWidget*, QPropertyAnimation*> it(m_animation[type]);
+ QMutableHashIterator<QGraphicsWidget*, QPropertyAnimation*> it(m_animation[type]);
while (it.hasNext()) {
it.next();
QPropertyAnimation* propertyAnim = it.value();
if (propertyAnim == finishedAnim) {
QGraphicsWidget* widget = it.key();
- m_animation[type].remove(widget);
+ it.remove();
finishedAnim->deleteLater();
emit finished(widget, static_cast<AnimationType>(type));