aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4objectiterator.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-11-28 13:25:56 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-12-20 07:39:24 +0100
commited9db939b1fe5ea2f620a4992abdbc553fa3ac41 (patch)
treebd51a5b09a6615ca3e302a27916b51c8681064a6 /src/qml/jsruntime/qv4objectiterator.cpp
parent9b43867c06ed56ff3c636892af43013842ea12a1 (diff)
Fix the way we set the property name during iteration
This was broken due to the new inheritance scheme for Managed Change-Id: Ia9df50e7e655c3a812a01a2c78945e648aa444dc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4objectiterator.cpp')
-rw-r--r--src/qml/jsruntime/qv4objectiterator.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/qml/jsruntime/qv4objectiterator.cpp b/src/qml/jsruntime/qv4objectiterator.cpp
index 338f756208..80b73e52dc 100644
--- a/src/qml/jsruntime/qv4objectiterator.cpp
+++ b/src/qml/jsruntime/qv4objectiterator.cpp
@@ -78,9 +78,9 @@ void ObjectIterator::init(Object *o)
}
}
-void ObjectIterator::next(String *&name, uint *index, Property *pd, PropertyAttributes *attrs)
+void ObjectIterator::next(Heap::String **name, uint *index, Property *pd, PropertyAttributes *attrs)
{
- name = (String *)0;
+ *name = 0;
*index = UINT_MAX;
if (!object->asObject()) {
@@ -89,6 +89,7 @@ void ObjectIterator::next(String *&name, uint *index, Property *pd, PropertyAttr
}
Scope scope(engine);
ScopedObject o(scope);
+ ScopedString n(scope);
while (1) {
if (!current->asObject())
@@ -101,9 +102,10 @@ void ObjectIterator::next(String *&name, uint *index, Property *pd, PropertyAttr
// check the property is not already defined earlier in the proto chain
if (current->asObject() != object->asObject()) {
o = object->asObject();
+ n = *name;
bool shadowed = false;
while (o != current->asObject()) {
- if ((!!name && o->hasOwnProperty(name)) ||
+ if ((!!n && o->hasOwnProperty(n)) ||
(*index != UINT_MAX && o->hasOwnProperty(*index))) {
shadowed = true;
break;
@@ -137,9 +139,7 @@ ReturnedValue ObjectIterator::nextPropertyName(ValueRef value)
uint index;
Scope scope(object->engine());
ScopedString name(scope);
- String *n;
- next(n, &index, &p, &attrs);
- name = n;
+ next(name.getRef(), &index, &p, &attrs);
if (attrs.isEmpty())
return Encode::null();
@@ -161,9 +161,7 @@ ReturnedValue ObjectIterator::nextPropertyNameAsString(ValueRef value)
uint index;
Scope scope(object->engine());
ScopedString name(scope);
- String *n;
- next(n, &index, &p, &attrs);
- name = n;
+ next(name.getRef(), &index, &p, &attrs);
if (attrs.isEmpty())
return Encode::null();
@@ -185,9 +183,7 @@ ReturnedValue ObjectIterator::nextPropertyNameAsString()
uint index;
Scope scope(object->engine());
ScopedString name(scope);
- String *n;
- next(n, &index, &p, &attrs);
- name = n;
+ next(name.getRef(), &index, &p, &attrs);
if (attrs.isEmpty())
return Encode::null();