aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-24 12:13:42 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-26 09:05:19 +0200
commita57085f00b146798a0cca0d52dfa127232c3e659 (patch)
tree7b4df3f155d431aeb6f3aae01943a3411c812a7b
parent12fd2ccd3fa2dc0133b5a3fb89f9fdf5cf721232 (diff)
Fix API of QQmlV4Handle
Change-Id: Iac4a3fefebd33a5990408598486231a5add8e639 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r--src/imports/dialogs-private/qquickfontlistmodel.cpp4
-rw-r--r--src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp4
-rw-r--r--src/imports/testlib/main.cpp11
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel.cpp4
-rw-r--r--src/particles/qquickcustomaffector.cpp8
-rw-r--r--src/particles/qquickparticleemitter.cpp4
-rw-r--r--src/particles/qquicktrailemitter.cpp6
-rw-r--r--src/particles/qquickv4particledata.cpp2
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp6
-rw-r--r--src/qml/qml/qqmlboundsignal.cpp2
-rw-r--r--src/qml/qml/v8/qv8engine_p.h15
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp15
-rw-r--r--src/qml/types/qqmllistmodel.cpp11
-rw-r--r--src/quick/items/context2d/qquickcanvascontext_p.h2
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp6
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp4
-rw-r--r--src/quick/items/context2d/qquickcontext2d_p.h2
-rw-r--r--src/quick/util/qquickglobal.cpp24
18 files changed, 67 insertions, 63 deletions
diff --git a/src/imports/dialogs-private/qquickfontlistmodel.cpp b/src/imports/dialogs-private/qquickfontlistmodel.cpp
index 233001b723..9d3b90f4d9 100644
--- a/src/imports/dialogs-private/qquickfontlistmodel.cpp
+++ b/src/imports/dialogs-private/qquickfontlistmodel.cpp
@@ -211,7 +211,7 @@ QQmlV4Handle QQuickFontListModel::get(int idx) const
Q_D(const QQuickFontListModel);
if (idx < 0 || idx >= count())
- return QQmlV4Handle(Value::undefinedValue());
+ return QQmlV4Handle(Encode::undefined());
QQmlEngine *engine = qmlContext(this)->engine();
QV8Engine *v8engine = QQmlEnginePrivate::getV8Engine(engine);
@@ -224,7 +224,7 @@ QQmlV4Handle QQuickFontListModel::get(int idx) const
p->value = Value::fromReturnedValue(v8engine->fromVariant(data(index(idx, 0), Qt::UserRole + ii + 1)));
}
- return QQmlV4Handle(o.asValue());
+ return QQmlV4Handle(o);
}
QQmlV4Handle QQuickFontListModel::pointSizes()
diff --git a/src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp b/src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp
index ffe82fce12..0183d67017 100644
--- a/src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp
+++ b/src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp
@@ -149,7 +149,7 @@ QQmlV4Handle QQuickWritingSystemListModel::get(int idx) const
Q_D(const QQuickWritingSystemListModel);
if (idx < 0 || idx >= count())
- return QQmlV4Handle(Value::undefinedValue());
+ return QQmlV4Handle(Encode::undefined());
QQmlEngine *engine = qmlContext(this)->engine();
QV8Engine *v8engine = QQmlEnginePrivate::getV8Engine(engine);
@@ -162,7 +162,7 @@ QQmlV4Handle QQuickWritingSystemListModel::get(int idx) const
p->value = Value::fromReturnedValue(v8engine->fromVariant(data(index(idx, 0), Qt::UserRole + ii + 1)));
}
- return QQmlV4Handle(o.asValue());
+ return QQmlV4Handle(o);
}
void QQuickWritingSystemListModel::classBegin()
diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp
index 6e4a397f4a..47570afbda 100644
--- a/src/imports/testlib/main.cpp
+++ b/src/imports/testlib/main.cpp
@@ -99,7 +99,9 @@ public Q_SLOTS:
QQmlEngine *engine = qmlEngine(this);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine->handle());
- return QQmlV4Handle(QV4::Value::fromString(v4->newString(name)));
+ QV4::Scope scope(v4);
+ QV4::ScopedValue s(scope, QV4::Value::fromString(v4->newString(name)));
+ return QQmlV4Handle(s);
}
bool compare(const QVariant& act, const QVariant& exp) const {
@@ -110,10 +112,13 @@ public Q_SLOTS:
{
QQmlEngine *engine = qmlEngine(this);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine->handle());
+ QV4::Scope scope(v4);
QVector<QV4::ExecutionEngine::StackFrame> stack = v4->stackTrace(frameIndex + 2);
- if (stack.size() > frameIndex + 1)
- return QQmlV4Handle(QV4::Value::fromString(v4->newString(stack.at(frameIndex + 1).source)));
+ if (stack.size() > frameIndex + 1) {
+ QV4::ScopedValue s(scope, v4->newString(stack.at(frameIndex + 1).source));
+ return QQmlV4Handle(s);
+ }
return QQmlV4Handle();
}
int callerLine(int frameIndex = 0) const
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
index 2991bd9755..c32fefe974 100644
--- a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
+++ b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
@@ -918,7 +918,7 @@ QQmlV4Handle QQuickXmlListModel::get(int index) const
Q_D(const QQuickXmlListModel);
if (index < 0 || index >= count())
- return QQmlV4Handle(Value::undefinedValue());
+ return QQmlV4Handle(Encode::undefined());
QQmlEngine *engine = qmlContext(this)->engine();
QV8Engine *v8engine = QQmlEnginePrivate::getV8Engine(engine);
@@ -931,7 +931,7 @@ QQmlV4Handle QQuickXmlListModel::get(int index) const
p->value = Value::fromReturnedValue(v8engine->fromVariant(d->data.value(ii).value(index)));
}
- return QQmlV4Handle(o.asValue());
+ return QQmlV4Handle(o);
}
/*!
diff --git a/src/particles/qquickcustomaffector.cpp b/src/particles/qquickcustomaffector.cpp
index 583e3b6555..7c4d45d24e 100644
--- a/src/particles/qquickcustomaffector.cpp
+++ b/src/particles/qquickcustomaffector.cpp
@@ -150,11 +150,11 @@ void QQuickCustomAffector::affectSystem(qreal dt)
QV4::Scoped<QV4::ArrayObject> array(scope, v4->newArrayObject(toAffect.size()));
QV4::ScopedValue v(scope);
for (int i=0; i<toAffect.size(); i++)
- array->putIndexed(i, (v = toAffect[i]->v4Value().toValue()));
+ array->putIndexed(i, (v = toAffect[i]->v4Value()));
if (dt >= simulationCutoff || dt <= simulationDelta) {
affectProperties(toAffect, dt);
- emit affectParticles(QQmlV4Handle(array.asValue()), dt);
+ emit affectParticles(QQmlV4Handle(array), dt);
} else {
int realTime = m_system->timeInt;
m_system->timeInt -= dt * 1000.0;
@@ -162,12 +162,12 @@ void QQuickCustomAffector::affectSystem(qreal dt)
m_system->timeInt += simulationDelta * 1000.0;
dt -= simulationDelta;
affectProperties(toAffect, simulationDelta);
- emit affectParticles(QQmlV4Handle(array.asValue()), simulationDelta);
+ emit affectParticles(QQmlV4Handle(array), simulationDelta);
}
m_system->timeInt = realTime;
if (dt > 0.0) {
affectProperties(toAffect, dt);
- emit affectParticles(QQmlV4Handle(array.asValue()), dt);
+ emit affectParticles(QQmlV4Handle(array), dt);
}
}
diff --git a/src/particles/qquickparticleemitter.cpp b/src/particles/qquickparticleemitter.cpp
index d42c92304b..0f251ea751 100644
--- a/src/particles/qquickparticleemitter.cpp
+++ b/src/particles/qquickparticleemitter.cpp
@@ -488,9 +488,9 @@ void QQuickParticleEmitter::emitWindow(int timeStamp)
QV4::Scoped<QV4::ArrayObject> array(scope, v4->newArrayObject(toEmit.size()));
QV4::ScopedValue v(scope);
for (int i=0; i<toEmit.size(); i++)
- array->putIndexed(i, (v = toEmit[i]->v4Value().toValue()));
+ array->putIndexed(i, (v = toEmit[i]->v4Value()));
- emitParticles(QQmlV4Handle(array.asValue()));//A chance for arbitrary JS changes
+ emitParticles(QQmlV4Handle(array));//A chance for arbitrary JS changes
}
m_last_emission = pt;
diff --git a/src/particles/qquicktrailemitter.cpp b/src/particles/qquicktrailemitter.cpp
index b78745f030..7b5788f467 100644
--- a/src/particles/qquicktrailemitter.cpp
+++ b/src/particles/qquicktrailemitter.cpp
@@ -276,12 +276,12 @@ void QQuickTrailEmitter::emitWindow(int timeStamp)
QV4::Scoped<QV4::ArrayObject> array(scope, v4->newArrayObject(toEmit.size()));
QV4::ScopedValue v(scope);
for (int i=0; i<toEmit.size(); i++)
- array->putIndexed(i, (v = toEmit[i]->v4Value().toValue()));
+ array->putIndexed(i, (v = toEmit[i]->v4Value()));
if (isEmitFollowConnected())
- emitFollowParticles(QQmlV4Handle(array.asValue()), d->v4Value());//A chance for many arbitrary JS changes
+ emitFollowParticles(QQmlV4Handle(array), d->v4Value());//A chance for many arbitrary JS changes
else if (isEmitConnected())
- emitParticles(QQmlV4Handle(array.asValue()));//A chance for arbitrary JS changes
+ emitParticles(QQmlV4Handle(array));//A chance for arbitrary JS changes
}
m_lastEmission[d->index] = pt;
}
diff --git a/src/particles/qquickv4particledata.cpp b/src/particles/qquickv4particledata.cpp
index 8cbe42bdd3..71ca4d31d0 100644
--- a/src/particles/qquickv4particledata.cpp
+++ b/src/particles/qquickv4particledata.cpp
@@ -525,7 +525,7 @@ QQuickV4ParticleData::~QQuickV4ParticleData()
QQmlV4Handle QQuickV4ParticleData::v4Value()
{
- return QQmlV4Handle(QV4::Value::fromReturnedValue(m_v4Value.value()));
+ return QQmlV4Handle(m_v4Value.value());
}
QT_END_NAMESPACE
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index c0c68bb6fd..10b3c57d4b 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -186,7 +186,7 @@ static QV4::ReturnedValue LoadProperty(QV8Engine *engine, QObject *object,
} else if (property.isV4Handle()) {
QQmlV4Handle handle;
ReadFunction(object, property, &handle, notifier);
- return handle.toValue().asReturnedValue();
+ return handle;
} else if (property.propType == qMetaTypeId<QJSValue>()) {
QJSValue v;
ReadFunction(object, property, &v, notifier);
@@ -1552,7 +1552,7 @@ void CallArgument::fromValue(int callType, QV8Engine *engine, const QV4::Value &
}
type = callType;
} else if (callType == qMetaTypeId<QQmlV4Handle>()) {
- handlePtr = new (&allocData) QQmlV4Handle(QQmlV4Handle(value));
+ handlePtr = new (&allocData) QQmlV4Handle(value.asReturnedValue());
type = callType;
} else if (callType == QMetaType::QJsonArray) {
jsonArrayPtr = new (&allocData) QJsonArray(QV4::JsonObject::toJsonArray(value.asArrayObject()));
@@ -1634,7 +1634,7 @@ QV4::ReturnedValue CallArgument::toValue(QV8Engine *engine)
array->setArrayLengthUnchecked(list.count());
return array.asReturnedValue();
} else if (type == qMetaTypeId<QQmlV4Handle>()) {
- return handlePtr->toValue().asReturnedValue();
+ return *handlePtr;
} else if (type == QMetaType::QJsonArray) {
return QV4::JsonObject::fromJsonArray(v4, *jsonArrayPtr);
} else if (type == QMetaType::QJsonObject) {
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp
index cc2edb7b19..5db3de0988 100644
--- a/src/qml/qml/qqmlboundsignal.cpp
+++ b/src/qml/qml/qqmlboundsignal.cpp
@@ -215,7 +215,7 @@ void QQmlBoundSignalExpression::evaluate(void **a)
//### optimization. Can go away if we switch to metaTypeToJS, or be expanded otherwise
args[ii] = QV4::Value::fromInt32(*reinterpret_cast<const int*>(a[ii + 1]));
} else if (type == qMetaTypeId<QQmlV4Handle>()) {
- args[ii] = reinterpret_cast<QQmlV4Handle *>(a[ii + 1])->toValue();
+ args[ii] = QV4::Value::fromReturnedValue(*reinterpret_cast<QQmlV4Handle *>(a[ii + 1]));
} else if (ep->isQObject(type)) {
if (!*reinterpret_cast<void* const *>(a[ii + 1]))
args[ii] = QV4::Value::nullValue();
diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h
index 3209e55434..90c4745d49 100644
--- a/src/qml/qml/v8/qv8engine_p.h
+++ b/src/qml/qml/v8/qv8engine_p.h
@@ -151,23 +151,16 @@ private:
QV8Engine *e;
};
-// ### GC
class Q_QML_PRIVATE_EXPORT QQmlV4Handle
{
public:
- QQmlV4Handle() : d(0) {}
- QQmlV4Handle(const QQmlV4Handle &other) : d(other.d) {}
- QQmlV4Handle &operator=(const QQmlV4Handle &other) { d = other.d; return *this; }
- explicit QQmlV4Handle(const QV4::Value &v) : d(v.val) {}
+ QQmlV4Handle() : d(QV4::Encode::undefined()) {}
+ explicit QQmlV4Handle(QV4::ValueRef v) : d(v.asReturnedValue()) {}
+ explicit QQmlV4Handle(QV4::ReturnedValue v) : d(v) {}
- QV4::Value toValue() const {
- QV4::Value v;
- v.val = d;
- return v;
- }
+ operator QV4::ReturnedValue() const { return d; }
private:
- QQmlV4Handle(quint64 h) : d(h) {}
quint64 d;
};
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index 97aa3ec628..8537e1a68e 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -2160,8 +2160,9 @@ void QQmlDelegateModelGroupPrivate::emitChanges(QV8Engine *engine)
{
Q_Q(QQmlDelegateModelGroup);
if (isChangedConnected() && !changeSet.isEmpty()) {
- QV4::Value removed = engineData(engine)->array(engine, changeSet.removes());
- QV4::Value inserted = engineData(engine)->array(engine, changeSet.inserts());
+ QV4::Scope scope(QV8Engine::getV4(engine));
+ QV4::ScopedValue removed(scope, engineData(engine)->array(engine, changeSet.removes()));
+ QV4::ScopedValue inserted(scope, engineData(engine)->array(engine, changeSet.inserts()));
emit q->changed(QQmlV4Handle(removed), QQmlV4Handle(inserted));
}
if (changeSet.difference() != 0)
@@ -2360,14 +2361,14 @@ QQmlV4Handle QQmlDelegateModelGroup::get(int index)
{
Q_D(QQmlDelegateModelGroup);
if (!d->model)
- return QQmlV4Handle(QV4::Value::undefinedValue());;
+ return QQmlV4Handle(QV4::Encode::undefined());
QQmlDelegateModelPrivate *model = QQmlDelegateModelPrivate::get(d->model);
if (!model->m_context->isValid()) {
- return QQmlV4Handle(QV4::Value::undefinedValue());
+ return QQmlV4Handle(QV4::Encode::undefined());
} else if (index < 0 || index >= model->m_compositor.count(d->group)) {
qmlInfo(this) << tr("get: index out of range");
- return QQmlV4Handle(QV4::Value::undefinedValue());
+ return QQmlV4Handle(QV4::Encode::undefined());
}
Compositor::iterator it = model->m_compositor.find(d->group, index);
@@ -2379,7 +2380,7 @@ QQmlV4Handle QQmlDelegateModelGroup::get(int index)
cacheItem = model->m_adaptorModel.createItem(
model->m_cacheMetaType, model->m_context->engine(), it.modelIndex());
if (!cacheItem)
- return QQmlV4Handle(QV4::Value::undefinedValue());
+ return QQmlV4Handle(QV4::Encode::undefined());
cacheItem->groups = it->flags;
model->m_cache.insert(it.cacheIndex, cacheItem);
@@ -2396,7 +2397,7 @@ QQmlV4Handle QQmlDelegateModelGroup::get(int index)
o->setPrototype(p.getPointer());
++cacheItem->scriptRef;
- return QQmlV4Handle(o.asValue());
+ return QQmlV4Handle(o);
}
bool QQmlDelegateModelGroupPrivate::parseIndex(const QV4::Value &value, int *index, Compositor::Group *group) const
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index 4ce5047c8f..7965bc046d 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -2142,7 +2142,8 @@ QQmlV4Handle QQmlListModel::get(int index) const
*/
void QQmlListModel::set(int index, const QQmlV4Handle &handle)
{
- QV4::Object *object = handle.toValue().asObject();
+ QV4::Scope scope(QV8Engine::getV4(engine()));
+ QV4::ScopedObject object(scope, handle);
if (!object) {
qmlInfo(this) << tr("set: value is not an object");
@@ -2157,9 +2158,9 @@ void QQmlListModel::set(int index, const QQmlV4Handle &handle)
if (index == count()) {
if (m_dynamicRoles) {
- m_modelObjects.append(DynamicRoleModelNode::create(engine()->variantMapFromJS(object), this));
+ m_modelObjects.append(DynamicRoleModelNode::create(engine()->variantMapFromJS(object.getPointer()), this));
} else {
- m_listModel->insert(index, object, engine());
+ m_listModel->insert(index, object.getPointer(), engine());
}
emitItemsInserted(index, 1);
@@ -2168,9 +2169,9 @@ void QQmlListModel::set(int index, const QQmlV4Handle &handle)
QVector<int> roles;
if (m_dynamicRoles) {
- m_modelObjects[index]->updateValues(engine()->variantMapFromJS(object), roles);
+ m_modelObjects[index]->updateValues(engine()->variantMapFromJS(object.getPointer()), roles);
} else {
- m_listModel->set(index, object, &roles, engine());
+ m_listModel->set(index, object.getPointer(), &roles, engine());
}
if (roles.count())
diff --git a/src/quick/items/context2d/qquickcanvascontext_p.h b/src/quick/items/context2d/qquickcanvascontext_p.h
index 2e3044008e..5c3359a2a9 100644
--- a/src/quick/items/context2d/qquickcanvascontext_p.h
+++ b/src/quick/items/context2d/qquickcanvascontext_p.h
@@ -69,7 +69,7 @@ public:
virtual void flush();
virtual void setV8Engine(QV8Engine *engine) = 0;
- virtual QV4::Value v4value() const = 0;
+ virtual QV4::ReturnedValue v4value() const = 0;
virtual QSGDynamicTexture *texture() const = 0;
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index 78369eb404..50a5431740 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -370,7 +370,7 @@ QQmlV4Handle QQuickCanvasItem::context() const
if (d->context)
return QQmlV4Handle(d->context->v4value());
- return QQmlV4Handle(QV4::Value::nullValue());
+ return QQmlV4Handle(QV4::Encode::null());
}
/*!
@@ -755,7 +755,7 @@ void QQuickCanvasItem::getContext(QQmlV4Function *args)
if (d->context != 0) {
if (d->context->contextNames().contains(contextId, Qt::CaseInsensitive)) {
- args->setReturnValue(d->context->v4value());
+ args->setReturnValue(QV4::Value::fromReturnedValue(d->context->v4value()));
return;
}
@@ -765,7 +765,7 @@ void QQuickCanvasItem::getContext(QQmlV4Function *args)
}
if (createContext(contextId))
- args->setReturnValue(d->context->v4value());
+ args->setReturnValue(QV4::Value::fromReturnedValue(d->context->v4value()));
else
args->setReturnValue(QV4::Value::nullValue());
}
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index ea3bd77509..4b6f074354 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -4044,9 +4044,9 @@ QQuickContext2D::~QQuickContext2D()
m_texture->deleteLater();
}
-QV4::Value QQuickContext2D::v4value() const
+QV4::ReturnedValue QQuickContext2D::v4value() const
{
- return QV4::Value::fromReturnedValue(m_v4value.value());
+ return m_v4value.value();
}
QStringList QQuickContext2D::contextNames() const
diff --git a/src/quick/items/context2d/qquickcontext2d_p.h b/src/quick/items/context2d/qquickcontext2d_p.h
index 8164108bd3..0d5926a27f 100644
--- a/src/quick/items/context2d/qquickcontext2d_p.h
+++ b/src/quick/items/context2d/qquickcontext2d_p.h
@@ -175,7 +175,7 @@ public:
QSGDynamicTexture *texture() const;
QImage toImage(const QRectF& bounds);
- QV4::Value v4value() const;
+ QV4::ReturnedValue v4value() const;
void setV8Engine(QV8Engine *eng);
QQuickCanvasItem* canvas() const { return m_canvas; }
diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp
index cf3d9acfa3..ea0b85c9ff 100644
--- a/src/quick/util/qquickglobal.cpp
+++ b/src/quick/util/qquickglobal.cpp
@@ -317,15 +317,15 @@ public:
if (ok) *ok = false;
QFont retn;
- QV4::Object *obj = object.toValue().asObject();
+ QV4::ExecutionEngine *v4 = QV8Engine::getV4(e);
+ QV4::Scope scope(v4);
+ QV4::ScopedObject obj(scope, object);
if (!obj) {
if (ok)
*ok = false;
return retn;
}
- QV4::ExecutionEngine *v4 = obj->engine();
- QV4::Scope scope(v4);
QV4::ScopedString s(scope);
QV4::Value vbold = QV4::Value::fromReturnedValue(obj->get((s = v4->newString(QStringLiteral("bold")))));
@@ -389,15 +389,15 @@ public:
return retn;
}
- static QMatrix4x4 matrix4x4FromObject(QQmlV4Handle object, bool *ok)
+ static QMatrix4x4 matrix4x4FromObject(QQmlV4Handle object, QV8Engine *e, bool *ok)
{
if (ok) *ok = false;
- QV4::ArrayObject *array = object.toValue().asArrayObject();
+ QV4::ExecutionEngine *v4 = QV8Engine::getV4(e);
+ QV4::Scope scope(v4);
+ QV4::ScopedArrayObject array(scope, object);
if (!array)
return QMatrix4x4();
- QV4::Scope scope(array->engine());
-
if (array->arrayLength() != 16)
return QMatrix4x4();
@@ -763,15 +763,19 @@ public:
bool variantFromJsObject(int type, QQmlV4Handle object, QV8Engine *e, QVariant *v)
{
- // must be called with a valid v8 context.
- Q_ASSERT(object.toValue().isObject());
+ QV4::ExecutionEngine *v4 = QV8Engine::getV4(e);
+ QV4::Scope scope(v4);
+#ifndef QT_NO_DEBUG
+ QV4::ScopedObject obj(scope, object);
+ Q_ASSERT(obj);
+#endif
bool ok = false;
switch (type) {
case QMetaType::QFont:
*v = QVariant::fromValue(fontFromObject(object, e, &ok));
break;
case QMetaType::QMatrix4x4:
- *v = QVariant::fromValue(matrix4x4FromObject(object, &ok));
+ *v = QVariant::fromValue(matrix4x4FromObject(object, e, &ok));
default: break;
}