aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsapi
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsapi')
-rw-r--r--src/qml/jsapi/qjsvalue.cpp4
-rw-r--r--src/qml/jsapi/qjsvalueiterator.cpp10
2 files changed, 8 insertions, 6 deletions
diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp
index 87c45e4779..987dd8b29f 100644
--- a/src/qml/jsapi/qjsvalue.cpp
+++ b/src/qml/jsapi/qjsvalue.cpp
@@ -801,11 +801,11 @@ QJSValue QJSValue::property(const QString& name) const
return QJSValue();
QV4::Scope scope(engine);
- Object *o = d->value.asObject();
+ ScopedObject o(scope, d->value);
if (!o)
return QJSValue();
- String *s = engine->newString(name);
+ ScopedString s(scope, engine->newString(name));
uint idx = s->asArrayIndex();
if (idx < UINT_MAX)
return property(idx);
diff --git a/src/qml/jsapi/qjsvalueiterator.cpp b/src/qml/jsapi/qjsvalueiterator.cpp
index 2b074c3cb2..b4156dcd1d 100644
--- a/src/qml/jsapi/qjsvalueiterator.cpp
+++ b/src/qml/jsapi/qjsvalueiterator.cpp
@@ -179,12 +179,14 @@ QJSValue QJSValueIterator::value() const
QV4::ExecutionContext *ctx = engine->current;
try {
QV4::ScopedValue v(scope);
- if (d_ptr->currentName)
- v = o->get(d_ptr->currentName);
- else if (d_ptr->currentIndex != UINT_MAX)
+ if (d_ptr->currentName) {
+ QV4::ScopedString n(scope, d_ptr->currentName);
+ v = o->get(n);
+ } else if (d_ptr->currentIndex != UINT_MAX) {
v = o->getIndexed(d_ptr->currentIndex);
- else
+ } else {
return QJSValue();
+ }
return new QJSValuePrivate(engine, v);
} catch (QV4::Exception &e) {
e.accept(ctx);