aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlcontextwrapper.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/qqmlcontextwrapper.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/qqmlcontextwrapper.cpp')
-rw-r--r--src/qml/qml/qqmlcontextwrapper.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp
index b7bb91f279..15974b07fa 100644
--- a/src/qml/qml/qqmlcontextwrapper.cpp
+++ b/src/qml/qml/qqmlcontextwrapper.cpp
@@ -76,23 +76,25 @@ QmlContextWrapper::~QmlContextWrapper()
ReturnedValue QmlContextWrapper::qmlScope(QV8Engine *v8, QQmlContextData *ctxt, QObject *scope)
{
ExecutionEngine *v4 = QV8Engine::getV4(v8);
+ Scope valueScope(v4);
- QmlContextWrapper *w = new (v4->memoryManager) QmlContextWrapper(v8, ctxt, scope);
- return Value::fromObject(w).asReturnedValue();
+ Scoped<QmlContextWrapper> w(valueScope, new (v4->memoryManager) QmlContextWrapper(v8, ctxt, scope));
+ return w.asReturnedValue();
}
ReturnedValue QmlContextWrapper::urlScope(QV8Engine *v8, const QUrl &url)
{
ExecutionEngine *v4 = QV8Engine::getV4(v8);
+ Scope scope(v4);
QQmlContextData *context = new QQmlContextData;
context->url = url;
context->isInternal = true;
context->isJSContext = true;
- QmlContextWrapper *w = new (v4->memoryManager) QmlContextWrapper(v8, context, 0);
+ Scoped<QmlContextWrapper> w(scope, new (v4->memoryManager) QmlContextWrapper(v8, context, 0));
w->isNullWrapper = true;
- return Value::fromObject(w).asReturnedValue();
+ return w.asReturnedValue();
}
QQmlContextData *QmlContextWrapper::callingContext(ExecutionEngine *v4)