diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-04-09 13:32:39 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-09 16:49:05 +0200 |
commit | 7b3eb5373a0d3611c5a83379c5eb59505cc5c074 (patch) | |
tree | b2f9f5e7beb86b065ef206f5d45025975ef49905 /src/quick/items | |
parent | 60730cbb5e5475b5db6a15641211aa6958a93197 (diff) |
Fix unreliable behavior of array methods on qml list properties
Array methods such as forEach rely on the hasProperty boolean of getIndexed to
be set appropriately. Some getIndexed implementation - such as the
QQmlListProperty one - didn't initialize it correctly and therefore the
behavior was undefined.
Task-number: QTBUG-38088
Change-Id: I34bc3136d8cc2bc280397d0c4d5051e7d72269e8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/quick/items')
-rw-r--r-- | src/quick/items/context2d/qquickcontext2d.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index 567ed64c2f..2a6eae71f7 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -3175,8 +3175,11 @@ QV4::ReturnedValue QQuickJSContext2DPixelData::getIndexed(QV4::Managed *m, uint QV4::ExecutionEngine *v4 = m->engine(); QV4::Scope scope(v4); QV4::Scoped<QQuickJSContext2DPixelData> r(scope, m->as<QQuickJSContext2DPixelData>()); - if (!m) + if (!m) { + if (hasProperty) + *hasProperty = false; return m->engine()->currentContext()->throwTypeError(); + } if (r && index < static_cast<quint32>(r->image.width() * r->image.height() * 4)) { if (hasProperty) |