aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsapi
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@jollamobile.com>2014-05-14 09:30:37 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-14 12:16:12 +0200
commit32398200fbb5b7e9ad4a1d1bfcf51b9fbd34a758 (patch)
tree7d0aefee335da67bf287e0130e14261f896f19a1 /src/qml/jsapi
parentc4a8d4a747559433e94d4af56c810ef86244d91f (diff)
Fix regression in QJSValueIterator::next() since Qt 5.1.1
Iteration on the form "while (next) { .. }" would skip the last element. Change-Id: I50692a5a75e23e423e82b7a39e1892f505e4c612 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/jsapi')
-rw-r--r--src/qml/jsapi/qjsvalueiterator.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/qml/jsapi/qjsvalueiterator.cpp b/src/qml/jsapi/qjsvalueiterator.cpp
index 9e02310815..6dcfafaa27 100644
--- a/src/qml/jsapi/qjsvalueiterator.cpp
+++ b/src/qml/jsapi/qjsvalueiterator.cpp
@@ -135,13 +135,10 @@ bool QJSValueIterator::hasNext() const
/*!
Advances the iterator by one position.
- Returns true if there is at least one item ahead of the iterator
- (i.e. the iterator is \e not at the back of the property sequence);
+ Returns true if there was at least one item ahead of the iterator
+ (i.e. the iterator was \e not already at the back of the property sequence);
otherwise returns false.
- Calling this function on an iterator located at the back of the
- container leads to undefined results.
-
\sa hasNext(), name()
*/
bool QJSValueIterator::next()
@@ -159,7 +156,7 @@ bool QJSValueIterator::next()
QV4::Scope scope(v4);
QV4::Scoped<QV4::ForEachIteratorObject> it(scope, d_ptr->iterator.value());
it->it.next(d_ptr->nextName, &d_ptr->nextIndex, &d_ptr->nextProperty, &d_ptr->nextAttributes);
- return !!d_ptr->nextName || d_ptr->nextIndex != UINT_MAX;
+ return !!d_ptr->currentName || d_ptr->currentIndex != UINT_MAX;
}
/*!