diff options
author | Jedrzej Nowacki <jedrzej.nowacki@nokia.com> | 2011-01-17 08:47:52 (GMT) |
---|---|---|
committer | Jedrzej Nowacki <jedrzej.nowacki@nokia.com> | 2011-01-17 10:57:29 (GMT) |
commit | e7907b32c323400562607253ec293e814c015f7a (patch) | |
tree | f83a38714d05ae7aa2968a49f5ebc7a410f05e87 /src/script | |
parent | 6c52715202ad8fd3c3f4bb94207cb7627c12f995 (diff) | |
download | Qt-e7907b32c323400562607253ec293e814c015f7a.zip Qt-e7907b32c323400562607253ec293e814c015f7a.tar.gz Qt-e7907b32c323400562607253ec293e814c015f7a.tar.bz2 |
Fix QScriptValueIterator::hasNext and QScriptValueIterator::hasPrevious
When a script engine is about to be deleted all bound iterators should
be invalidated. Previously behavior of the class was not tested for the
case, so new test for QScriptValueIterator was added.
Reviewed-by: Olivier Goffart
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/api/qscriptvalueiterator.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/script/api/qscriptvalueiterator.cpp b/src/script/api/qscriptvalueiterator.cpp index ecda5fc..d8c7b64 100644 --- a/src/script/api/qscriptvalueiterator.cpp +++ b/src/script/api/qscriptvalueiterator.cpp @@ -162,7 +162,7 @@ QScriptValueIterator::~QScriptValueIterator() bool QScriptValueIterator::hasNext() const { Q_D(const QScriptValueIterator); - if (!d) + if (!d || !d->engine()) return false; const_cast<QScriptValueIteratorPrivate*>(d)->ensureInitialized(); @@ -198,7 +198,7 @@ void QScriptValueIterator::next() bool QScriptValueIterator::hasPrevious() const { Q_D(const QScriptValueIterator); - if (!d) + if (!d || !d->engine()) return false; const_cast<QScriptValueIteratorPrivate*>(d)->ensureInitialized(); |