diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-14 11:25:02 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-18 13:14:13 +0200 |
commit | f79df5da0769836bc866b470cdac43d6363dc7db (patch) | |
tree | 28deb1584b6c43dca92b39328bcf43099a92fcd6 /src/qml/qml/qqmlcontextwrapper.cpp | |
parent | e4e90923c93adfafb23c81be7359e8df2a500b4f (diff) |
Convert more methods to return a Returned<>
Change-Id: If294c9c4f574824c308b63a11da1337226180105
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlcontextwrapper.cpp')
-rw-r--r-- | src/qml/qml/qqmlcontextwrapper.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp index 153743aa58..de317a2dcb 100644 --- a/src/qml/qml/qqmlcontextwrapper.cpp +++ b/src/qml/qml/qqmlcontextwrapper.cpp @@ -97,22 +97,22 @@ ReturnedValue QmlContextWrapper::urlScope(QV8Engine *v8, const QUrl &url) QQmlContextData *QmlContextWrapper::callingContext(ExecutionEngine *v4) { - QV4::Object *qmlglobal = v4->qmlContextObject(); - if (!qmlglobal) - return 0; + Scope scope(v4); + QV4::Scoped<QmlContextWrapper> c(scope, v4->qmlContextObject()->getPointer()->as<QmlContextWrapper>()); - QmlContextWrapper *c = qmlglobal->as<QmlContextWrapper>(); - return c ? c->getContext() : 0; + return !!c ? c->getContext() : 0; } QQmlContextData *QmlContextWrapper::getContext(const Value &value) { - Object *o = value.asObject(); - QmlContextWrapper *c = o ? o->as<QmlContextWrapper>() : 0; - if (!c) + QV4::ExecutionEngine *v4 = value.engine(); + if (!v4) return 0; - return c ? c->getContext():0; + Scope scope(v4); + QV4::Scoped<QmlContextWrapper> c(scope, value.as<QmlContextWrapper>()); + + return !!c ? c->getContext():0; } void QmlContextWrapper::takeContextOwnership(const Value &qmlglobal) |