diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-01-10 22:04:54 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2015-01-12 14:52:50 +0100 |
commit | 447844aa25754db7e868469de4537af4331709ac (patch) | |
tree | 80245a0d948e87c8cfd7a35eb5fdc93a65105ccd /src/qml/qml/qqmlcontextwrapper.cpp | |
parent | 56211be8a0429fb3e3fa268c7698e1df079aa04e (diff) |
Get rid of Value::engine()
This method is not guaranteed to return an engine. We're safer
checking for the value being an object first and then getting
the engine from there.
Change-Id: I5c95e675337e545f2421613bd31c42d1e58d6f9a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlcontextwrapper.cpp')
-rw-r--r-- | src/qml/qml/qqmlcontextwrapper.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp index f3551d8488..78a77f79d4 100644 --- a/src/qml/qml/qqmlcontextwrapper.cpp +++ b/src/qml/qml/qqmlcontextwrapper.cpp @@ -102,10 +102,10 @@ QQmlContextData *QmlContextWrapper::callingContext(ExecutionEngine *v4) QQmlContextData *QmlContextWrapper::getContext(const ValueRef value) { - QV4::ExecutionEngine *v4 = value->engine(); - if (!v4) + if (!value->isObject()) return 0; + QV4::ExecutionEngine *v4 = value->asObject()->engine(); Scope scope(v4); QV4::Scoped<QmlContextWrapper> c(scope, value); @@ -114,9 +114,9 @@ QQmlContextData *QmlContextWrapper::getContext(const ValueRef value) void QmlContextWrapper::takeContextOwnership(const ValueRef qmlglobal) { - QV4::ExecutionEngine *v4 = qmlglobal->engine(); - Q_ASSERT(v4); + Q_ASSERT(qmlglobal->isObject()); + QV4::ExecutionEngine *v4 = qmlglobal->asObject()->engine(); Scope scope(v4); QV4::Scoped<QmlContextWrapper> c(scope, qmlglobal); Q_ASSERT(c); |