aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmltypewrapper.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-25 15:24:50 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-28 13:33:39 +0200
commit150731fc68bcf823bec40729285813d902990cb7 (patch)
tree7af619f4bc8fac030bc162ce6ead2e2a7be86783 /src/qml/qml/qqmltypewrapper.cpp
parentc79cc3f30d395c94d4f14b978903d7db4ad871dc (diff)
Remove more direct QV4::Value usage
Remove Value::fromString(String *), and make Encode safe against encoding raw Managed * pointers. Change-Id: Ibca4668e1cbeaf85c78169d14386281659d33ef6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmltypewrapper.cpp')
-rw-r--r--src/qml/qml/qqmltypewrapper.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp
index 62f757f8c0..de2386daf1 100644
--- a/src/qml/qml/qqmltypewrapper.cpp
+++ b/src/qml/qml/qqmltypewrapper.cpp
@@ -91,10 +91,11 @@ ReturnedValue QmlTypeWrapper::create(QV8Engine *v8, QObject *o, QQmlType *t, Typ
{
Q_ASSERT(t);
ExecutionEngine *v4 = QV8Engine::getV4(v8);
+ Scope scope(v4);
- QmlTypeWrapper *w = new (v4->memoryManager) QmlTypeWrapper(v8);
+ Scoped<QmlTypeWrapper> w(scope, new (v4->memoryManager) QmlTypeWrapper(v8));
w->mode = mode; w->object = o; w->type = t;
- return Value::fromObject(w).asReturnedValue();
+ return w.asReturnedValue();
}
// Returns a type wrapper for importNamespace (of t) on o. This allows nested resolution of a type in a
@@ -104,11 +105,12 @@ ReturnedValue QmlTypeWrapper::create(QV8Engine *v8, QObject *o, QQmlTypeNameCach
Q_ASSERT(t);
Q_ASSERT(importNamespace);
ExecutionEngine *v4 = QV8Engine::getV4(v8);
+ Scope scope(v4);
- QmlTypeWrapper *w = new (v4->memoryManager) QmlTypeWrapper(v8);
+ Scoped<QmlTypeWrapper> w(scope, new (v4->memoryManager) QmlTypeWrapper(v8));
w->mode = mode; w->object = o; w->typeNamespace = t; w->importNamespace = importNamespace;
t->addref();
- return Value::fromObject(w).asReturnedValue();
+ return w.asReturnedValue();
}
@@ -117,7 +119,7 @@ ReturnedValue QmlTypeWrapper::get(Managed *m, const StringRef name, bool *hasPro
QV4::ExecutionEngine *v4 = m->engine();
QV4::Scope scope(v4);
- QmlTypeWrapper *w = m->as<QmlTypeWrapper>();
+ Scoped<QmlTypeWrapper> w(scope, m->as<QmlTypeWrapper>());
if (!w)
v4->current->throwTypeError();