aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsapi
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-27 17:04:42 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-30 08:05:51 +0200
commitc0ec918787068fcf269925b13a34115ff77c3126 (patch)
tree9e1a511baf5f7e1ff53a102294b28a839d2f10f5 /src/qml/jsapi
parente57c2c8a0adef8949f69195573d149237814bed1 (diff)
Remove some uses of raw Object pointers
Change-Id: I7c715f33d197ebbf6f0c00040099b27ed7221d42 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsapi')
-rw-r--r--src/qml/jsapi/qjsvalue.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp
index 5805b6a78f..8bcdccc507 100644
--- a/src/qml/jsapi/qjsvalue.cpp
+++ b/src/qml/jsapi/qjsvalue.cpp
@@ -690,7 +690,11 @@ QJSValue QJSValue::prototype() const
*/
void QJSValue::setPrototype(const QJSValue& prototype)
{
- Object *o = d->value.asObject();
+ ExecutionEngine *v4 = d->engine;
+ if (!v4)
+ return;
+ Scope scope(v4);
+ ScopedObject o(scope, d->value);
if (!o)
return;
if (prototype.d->value.isNull()) {
@@ -698,14 +702,14 @@ void QJSValue::setPrototype(const QJSValue& prototype)
return;
}
- Object *p = prototype.d->value.asObject();
+ ScopedObject p(scope, prototype.d->value);
if (!p)
return;
if (o->engine() != p->engine()) {
qWarning("QJSValue::setPrototype() failed: cannot set a prototype created in a different engine");
return;
}
- if (!o->setPrototype(p))
+ if (!o->setPrototype(p.getPointer()))
qWarning("QJSValue::setPrototype() failed: cyclic prototype value");
}
@@ -841,7 +845,7 @@ QJSValue QJSValue::property(quint32 arrayIndex) const
return QJSValue();
QV4::Scope scope(engine);
- Object *o = d->value.asObject();
+ ScopedObject o(scope, d->value);
if (!o)
return QJSValue();