From 7b3eb5373a0d3611c5a83379c5eb59505cc5c074 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 9 Apr 2014 13:32:39 +0200 Subject: 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 --- src/qml/qml/qqmlcontextwrapper.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/qml/qml/qqmlcontextwrapper.cpp') diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp index 54bf986b8e..a5574b706a 100644 --- a/src/qml/qml/qqmlcontextwrapper.cpp +++ b/src/qml/qml/qqmlcontextwrapper.cpp @@ -461,6 +461,9 @@ ReturnedValue QQmlIdObjectsArray::getIndexed(Managed *m, uint index, bool *hasPr return Encode::undefined(); } + if (hasProperty) + *hasProperty = true; + ExecutionEngine *v4 = m->engine(); QQmlEnginePrivate *ep = v4->v8Engine->engine() ? QQmlEnginePrivate::get(v4->v8Engine->engine()) : 0; if (ep) -- cgit v1.2.3