diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2011-09-30 17:52:27 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-04 05:16:43 +0200 |
commit | 01a60f8771ba273d164042710364b7fd88168dcc (patch) | |
tree | 03e23d16d358301c215e194b378dccdd98b2530f /src | |
parent | 8662e071c22c2be2fdf15148b375eb3f6057aab7 (diff) |
Fix incorrect index when accumulating multiple removes.
Don't remove the intersecting count from the current remove twice,
and accumulate consecutive not just overlapping removes.
Change-Id: I426d764d980ee17ad114aa03ca4089da89c6aed2
Reviewed-on: http://codereview.qt-project.org/5902
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/util/qdeclarativechangeset.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/declarative/util/qdeclarativechangeset.cpp b/src/declarative/util/qdeclarativechangeset.cpp index c264ca011e..33757062a1 100644 --- a/src/declarative/util/qdeclarativechangeset.cpp +++ b/src/declarative/util/qdeclarativechangeset.cpp @@ -276,7 +276,7 @@ void QDeclarativeChangeSet::applyRemovals(QVector<Remove> &removals, QVector<Ins for (; rend != m_removes.end() && rit->moveId == -1 && rend->moveId == -1 - && rit->index + rit->count > rend->index; ++rend) { + && rit->index + rit->count >= rend->index; ++rend) { count += rend->count; } if (remove != rend) { @@ -288,7 +288,6 @@ void QDeclarativeChangeSet::applyRemovals(QVector<Remove> &removals, QVector<Ins index += difference; rit->count -= difference; removeCount += difference; - remove->index = rit->index; remove->count = count; remove = m_removes.erase(++remove, rend); @@ -302,10 +301,10 @@ void QDeclarativeChangeSet::applyRemovals(QVector<Remove> &removals, QVector<Ins remove = m_removes.insert(remove, Remove(rit->index, offset, moveId)); ++remove; rit->count -= offset; + removeCount += offset; } remove->index = rit->index; index += offset; - removeCount += offset; ++remove; } else { @@ -313,15 +312,14 @@ void QDeclarativeChangeSet::applyRemovals(QVector<Remove> &removals, QVector<Ins remove = m_removes.insert(remove, Remove(rit->index, offset)); ++remove; rit->count -= offset; + removeCount += offset; } remove->index = rit->index; index += offset; - removeCount += offset; ++remove; } index += count; - rit->count -= count; } if (rit->count > 0) { |