aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/util
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-16 22:02:27 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-22 01:06:20 +0200
commite441692b0b8f8fffdfdfa8a21c570adcd5cbae7a (patch)
tree9b764401d87682012328c46dc947721f47b428b2 /src/qml/util
parenta0f8be4021caa9bb5055923f0eea3bee0e345235 (diff)
Further work towards an exact GC
Add some more convenience in the helper classes in qscopedvalue_p.h Make accesses to CallData safer, and change ExecutionEngine::newObject() to return a safe pointer. Change-Id: I980909754ce9681cf6faa1355bab3a1e5d6dd186 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/util')
-rw-r--r--src/qml/util/qqmladaptormodel.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp
index 9812e2a4a6..add422b8da 100644
--- a/src/qml/util/qqmladaptormodel.cpp
+++ b/src/qml/util/qqmladaptormodel.cpp
@@ -213,7 +213,8 @@ public:
void initializeConstructor(QQmlAdaptorModelEngineData *const data)
{
QV4::ExecutionEngine *v4 = data->v4;
- QV4::Object *proto = v4->newObject();
+ QV4::Scope scope(v4);
+ QV4::Scoped<QV4::Object> proto(scope, v4->newObject());
QV4::Property *p = proto->insertMember(v4->newString(QStringLiteral("index")),
QV4::Attr_Accessor|QV4::Attr_NotEnumerable|QV4::Attr_NotConfigurable);
p->setGetter(v4->newBuiltinFunction(v4->rootContext, v4->id_undefined, get_index));
@@ -232,7 +233,7 @@ public:
p->setGetter(new (v4->memoryManager) QV4::IndexedBuiltinFunction(v4->rootContext, propertyId, QQmlDMCachedModelData::get_property));
p->setSetter(new (v4->memoryManager) QV4::IndexedBuiltinFunction(v4->rootContext, propertyId, QQmlDMCachedModelData::set_property));
}
- prototype = QV4::Value::fromObject(proto);
+ prototype = proto.asValue();
}
// QAbstractDynamicMetaObject
@@ -955,7 +956,8 @@ void QQmlAdaptorModel::objectDestroyed(QObject *)
QQmlAdaptorModelEngineData::QQmlAdaptorModelEngineData(QV8Engine *e)
: v4(QV8Engine::getV4(e))
{
- QV4::Object *proto = v4->newObject();
+ QV4::Scope scope(v4);
+ QV4::Scoped<QV4::Object> proto(scope, v4->newObject());
QV4::Property *p = proto->insertMember(v4->newString(QStringLiteral("index")),
QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
p->setGetter(v4->newBuiltinFunction(v4->rootContext, v4->id_undefined, get_index));
@@ -963,7 +965,7 @@ QQmlAdaptorModelEngineData::QQmlAdaptorModelEngineData(QV8Engine *e)
QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
p->setGetter(v4->newBuiltinFunction(v4->rootContext, v4->id_undefined, QQmlDMListAccessorData::get_modelData));
p->setSetter(v4->newBuiltinFunction(v4->rootContext, v4->id_undefined, QQmlDMListAccessorData::set_modelData));
- listItemProto = QV4::Value::fromObject(proto);
+ listItemProto = proto;
}
QQmlAdaptorModelEngineData::~QQmlAdaptorModelEngineData()