diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2014-12-30 10:59:43 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2015-01-01 21:36:44 +0100 |
commit | 05b5f4bc16142a1e0bf6b30a8e0cefeab0c3f47b (patch) | |
tree | 727320792bd92d77c903484019670577e630441e /src | |
parent | 032619e11565743b0e607b2ad18db56cd7bd1e45 (diff) | |
download | qtdeclarative-05b5f4bc16142a1e0bf6b30a8e0cefeab0c3f47b.tar.gz |
Don't store a v8engine pointer in qqmllistwrapper
Change-Id: I21b055deb74aafff8b2ee1cdce776e06f154dcaa
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlcontextwrapper.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmllistwrapper.cpp | 23 | ||||
-rw-r--r-- | src/qml/qml/qqmllistwrapper_p.h | 7 | ||||
-rw-r--r-- | src/qml/qml/v8/qv8engine.cpp | 2 |
5 files changed, 16 insertions, 20 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 1af82ff25f..5ade6e1299 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -159,7 +159,7 @@ static QV4::ReturnedValue LoadProperty(QV8Engine *engine, QObject *object, ReadFunction(object, property, &rv, notifier); return QV4::QObjectWrapper::wrap(v4, rv); } else if (property.isQList()) { - return QmlListWrapper::create(engine, object, property.coreIndex, property.propType); + return QmlListWrapper::create(v4, object, property.coreIndex, property.propType); } else if (property.propType == QMetaType::QReal) { qreal v = 0; ReadFunction(object, property, &v, notifier); diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp index 7e386acd97..98b72c61b1 100644 --- a/src/qml/qml/qqmlcontextwrapper.cpp +++ b/src/qml/qml/qqmlcontextwrapper.cpp @@ -229,7 +229,7 @@ ReturnedValue QmlContextWrapper::get(Managed *m, String *name, bool *hasProperty QQmlListProperty<QObject> prop(context->asQQmlContext(), (void*) qintptr(propertyIdx), QQmlContextPrivate::context_count, QQmlContextPrivate::context_at); - return QmlListWrapper::create(engine, prop, qMetaTypeId<QQmlListProperty<QObject> >()); + return QmlListWrapper::create(v4, prop, qMetaTypeId<QQmlListProperty<QObject> >()); } else { return engine->fromVariant(cp->propertyValues.at(propertyIdx)); } diff --git a/src/qml/qml/qqmllistwrapper.cpp b/src/qml/qml/qqmllistwrapper.cpp index d27ed95844..f80d268365 100644 --- a/src/qml/qml/qqmllistwrapper.cpp +++ b/src/qml/qml/qqmllistwrapper.cpp @@ -45,13 +45,12 @@ using namespace QV4; DEFINE_OBJECT_VTABLE(QmlListWrapper); -Heap::QmlListWrapper::QmlListWrapper(QV8Engine *engine) - : Heap::Object(QV8Engine::getV4(engine)) - , v8(engine) +Heap::QmlListWrapper::QmlListWrapper(ExecutionEngine *engine) + : Heap::Object(engine) { setVTable(QV4::QmlListWrapper::staticVTable()); - QV4::Scope scope(QV8Engine::getV4(engine)); + QV4::Scope scope(engine); QV4::ScopedObject o(scope, this); o->setArrayType(Heap::ArrayData::Custom); } @@ -60,15 +59,14 @@ Heap::QmlListWrapper::~QmlListWrapper() { } -ReturnedValue QmlListWrapper::create(QV8Engine *v8, QObject *object, int propId, int propType) +ReturnedValue QmlListWrapper::create(ExecutionEngine *engine, QObject *object, int propId, int propType) { if (!object || propId == -1) return Encode::null(); - ExecutionEngine *v4 = QV8Engine::getV4(v8); - Scope scope(v4); + Scope scope(engine); - Scoped<QmlListWrapper> r(scope, v4->memoryManager->alloc<QmlListWrapper>(v8)); + Scoped<QmlListWrapper> r(scope, engine->memoryManager->alloc<QmlListWrapper>(engine)); r->d()->object = object; r->d()->propertyType = propType; void *args[] = { &r->d()->property, 0 }; @@ -76,12 +74,11 @@ ReturnedValue QmlListWrapper::create(QV8Engine *v8, QObject *object, int propId, return r.asReturnedValue(); } -ReturnedValue QmlListWrapper::create(QV8Engine *v8, const QQmlListProperty<QObject> &prop, int propType) +ReturnedValue QmlListWrapper::create(ExecutionEngine *engine, const QQmlListProperty<QObject> &prop, int propType) { - ExecutionEngine *v4 = QV8Engine::getV4(v8); - Scope scope(v4); + Scope scope(engine); - Scoped<QmlListWrapper> r(scope, v4->memoryManager->alloc<QmlListWrapper>(v8)); + Scoped<QmlListWrapper> r(scope, engine->memoryManager->alloc<QmlListWrapper>(engine)); r->d()->object = prop.object; r->d()->property = prop; r->d()->propertyType = propType; @@ -93,7 +90,7 @@ QVariant QmlListWrapper::toVariant() const if (!d()->object) return QVariant(); - return QVariant::fromValue(QQmlListReferencePrivate::init(d()->property, d()->propertyType, d()->v8->engine())); + return QVariant::fromValue(QQmlListReferencePrivate::init(d()->property, d()->propertyType, d()->internalClass->engine->v8Engine->engine())); } diff --git a/src/qml/qml/qqmllistwrapper_p.h b/src/qml/qml/qqmllistwrapper_p.h index 1345365657..1c2ad03992 100644 --- a/src/qml/qml/qqmllistwrapper_p.h +++ b/src/qml/qml/qqmllistwrapper_p.h @@ -62,9 +62,8 @@ namespace QV4 { namespace Heap { struct QmlListWrapper : Object { - QmlListWrapper(QV8Engine *engine); + QmlListWrapper(ExecutionEngine *engine); ~QmlListWrapper(); - QV8Engine *v8; QPointer<QObject> object; QQmlListProperty<QObject> property; int propertyType; @@ -77,8 +76,8 @@ struct Q_QML_EXPORT QmlListWrapper : Object V4_OBJECT2(QmlListWrapper, Object) V4_NEEDS_DESTROY - static ReturnedValue create(QV8Engine *v8, QObject *object, int propId, int propType); - static ReturnedValue create(QV8Engine *v8, const QQmlListProperty<QObject> &prop, int propType); + static ReturnedValue create(ExecutionEngine *engine, QObject *object, int propId, int propType); + static ReturnedValue create(ExecutionEngine *engine, const QQmlListProperty<QObject> &prop, int propType); QVariant toVariant() const; diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index e779c090be..cf66c5c2f3 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -421,7 +421,7 @@ QV4::ReturnedValue QV8Engine::fromVariant(const QVariant &variant) typedef QQmlListReferencePrivate QDLRP; QDLRP *p = QDLRP::get((QQmlListReference*)ptr); if (p->object) { - return QV4::QmlListWrapper::create(this, p->property, p->propertyType); + return QV4::QmlListWrapper::create(scope.engine, p->property, p->propertyType); } else { return QV4::Encode::null(); } |