diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-12 22:37:41 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-18 13:13:55 +0200 |
commit | a2d115fbaffee282a1d32ed92c6700e6c3dd811b (patch) | |
tree | 7694e53751edd605d99d1d8eb19c9cd5d6d8188a /src/qml/qml/qqmlvmemetaobject.cpp | |
parent | 399f88f6b75bb842be8e9d3671ace5114e115542 (diff) |
Convert most remaining return values from Value to ReturnedValue
Change-Id: If8b0c3b91be50678693868c10fefc3678008834d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlvmemetaobject.cpp')
-rw-r--r-- | src/qml/qml/qqmlvmemetaobject.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp index 360528ea7a..488b4a0adf 100644 --- a/src/qml/qml/qqmlvmemetaobject.cpp +++ b/src/qml/qml/qqmlvmemetaobject.cpp @@ -911,8 +911,10 @@ int QQmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a) QQmlEnginePrivate *ep = QQmlEnginePrivate::get(ctxt->engine); ep->referenceScarceResources(); // "hold" scarce resources in memory during evaluation. + QV4::Scope scope(ep->v4engine()); - QV4::FunctionObject *function = method(id).asFunctionObject(); + + QV4::Scoped<QV4::FunctionObject> function(scope, method(id)); if (!function) { // The function was not compiled. There are some exceptional cases which the // expression rewriter does not rewrite properly (e.g., \r-terminated lines @@ -927,12 +929,11 @@ int QQmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a) QQmlVMEMetaData::MethodData *data = metaData->methodData() + id; - QV4::Scope scope(function->engine()); QV4::ScopedCallData callData(scope, data->parameterCount); callData->thisObject = ep->v8engine()->global(); for (int ii = 0; ii < data->parameterCount; ++ii) - callData->args[ii] = ep->v8engine()->fromVariant(*(QVariant *)a[ii + 1]); + callData->args[ii] = QV4::Value::fromReturnedValue(ep->v8engine()->fromVariant(*(QVariant *)a[ii + 1])); QV4::ScopedValue result(scope); QV4::ExecutionContext *ctx = function->engine()->current; @@ -961,11 +962,11 @@ int QQmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a) return object->qt_metacall(c, _id, a); } -QV4::Value QQmlVMEMetaObject::method(int index) +QV4::ReturnedValue QQmlVMEMetaObject::method(int index) { if (!ctxt || !ctxt->isValid()) { qWarning("QQmlVMEMetaObject: Internal error - attempted to evaluate a function in an invalid context"); - return QV4::Value::emptyValue(); + return QV4::Value::emptyValue().asReturnedValue(); } if (!v8methods) @@ -984,16 +985,16 @@ QV4::Value QQmlVMEMetaObject::method(int index) ctxt->urlString, data->lineNumber); } - return v8methods[index]; + return v8methods[index].value().asReturnedValue(); } -QV4::Value QQmlVMEMetaObject::readVarProperty(int id) +QV4::ReturnedValue QQmlVMEMetaObject::readVarProperty(int id) { Q_ASSERT(id >= firstVarPropertyIndex); if (ensureVarPropertiesAllocated()) - return QV4::Value::fromReturnedValue(varProperties.value().asObject()->getIndexed(id - firstVarPropertyIndex)); - return QV4::Value::emptyValue(); + return varProperties.value().asObject()->getIndexed(id - firstVarPropertyIndex); + return QV4::Value::emptyValue().asReturnedValue(); } QVariant QQmlVMEMetaObject::readPropertyAsVariant(int id) @@ -1070,8 +1071,8 @@ void QQmlVMEMetaObject::writeProperty(int id, const QVariant &value) // And, if the new value is a scarce resource, we need to ensure that it does not get // automatically released by the engine until no other references to it exist. - QV4::Value newv = QQmlEnginePrivate::get(ctxt->engine)->v8engine()->fromVariant(value); - if (QV4::VariantObject *v = newv.as<QV4::VariantObject>()) + QV4::ScopedValue newv(scope, QQmlEnginePrivate::get(ctxt->engine)->v8engine()->fromVariant(value)); + if (QV4::VariantObject *v = newv->as<QV4::VariantObject>()) v->addVmePropertyReference(); // Write the value and emit change signal as appropriate. @@ -1150,7 +1151,7 @@ quint16 QQmlVMEMetaObject::vmeMethodLineNumber(int index) return data->lineNumber; } -QV4::Value QQmlVMEMetaObject::vmeMethod(int index) +QV4::ReturnedValue QQmlVMEMetaObject::vmeMethod(int index) { if (index < methodOffset()) { Q_ASSERT(parentVMEMetaObject()); @@ -1178,7 +1179,7 @@ void QQmlVMEMetaObject::setVmeMethod(int index, QV4::PersistentValue function) v8methods[methodIndex] = function; } -QV4::Value QQmlVMEMetaObject::vmeProperty(int index) +QV4::ReturnedValue QQmlVMEMetaObject::vmeProperty(int index) { if (index < propOffset()) { Q_ASSERT(parentVMEMetaObject()); |