aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-06-10 14:37:21 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-06-18 16:42:36 +0000
commitd4801fc76a0dff43abd3c4f46fb34553c8c5efd1 (patch)
tree26049030d9682df4f418a0f70e8190b102106337 /src
parentd475e72dc469dc6d442a36588e19a3e7eca48394 (diff)
Smaller cleanup in the context wrapper
Change-Id: If9f8139cdb67bd7a1179d8b1ab18bde04e3b2fbb Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/qml/qml/qqmlcontextwrapper.cpp11
-rw-r--r--src/qml/qml/qqmlcontextwrapper_p.h4
-rw-r--r--src/qml/qml/qqmltypeloader.cpp4
3 files changed, 5 insertions, 14 deletions
diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp
index 15bf790d4f..d06c557dfe 100644
--- a/src/qml/qml/qqmlcontextwrapper.cpp
+++ b/src/qml/qml/qqmlcontextwrapper.cpp
@@ -114,17 +114,6 @@ QQmlContextData *QmlContextWrapper::getContext(const Value &value)
return c ? c->getContext() : 0;
}
-void QmlContextWrapper::takeContextOwnership(const Value &qmlglobal)
-{
- Q_ASSERT(qmlglobal.isObject());
-
- QV4::ExecutionEngine *v4 = qmlglobal.as<Object>()->engine();
- Scope scope(v4);
- QV4::Scoped<QmlContextWrapper> c(scope, qmlglobal);
- Q_ASSERT(c);
- c->d()->ownsContext = true;
-}
-
ReturnedValue QmlContextWrapper::get(const Managed *m, String *name, bool *hasProperty)
{
diff --git a/src/qml/qml/qqmlcontextwrapper_p.h b/src/qml/qml/qqmlcontextwrapper_p.h
index c569d09cd7..9bd95efaa6 100644
--- a/src/qml/qml/qqmlcontextwrapper_p.h
+++ b/src/qml/qml/qqmlcontextwrapper_p.h
@@ -95,7 +95,9 @@ struct Q_QML_EXPORT QmlContextWrapper : Object
static ReturnedValue urlScope(ExecutionEngine *v4, const QUrl &);
static QQmlContextData *callingContext(ExecutionEngine *v4);
- static void takeContextOwnership(const Value &qmlglobal);
+ void takeContextOwnership() {
+ d()->ownsContext = true;
+ }
inline QObject *getScopeObject() const { return d()->scopeObject; }
inline QQmlContextData *getContext() const { return d()->context; }
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 431c5157e6..e860b8e0fa 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -2520,8 +2520,8 @@ QV4::PersistentValue QQmlScriptData::scriptValueForContext(QQmlContextData *pare
return QV4::PersistentValue();
}
- QV4::ScopedValue qmlglobal(scope, QV4::QmlContextWrapper::qmlScope(v4, ctxt, 0));
- QV4::QmlContextWrapper::takeContextOwnership(qmlglobal);
+ QV4::Scoped<QV4::QmlContextWrapper> qmlglobal(scope, QV4::QmlContextWrapper::qmlScope(v4, ctxt, 0));
+ qmlglobal->takeContextOwnership();
m_program->qml.set(scope.engine, qmlglobal);
m_program->run();