aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/jsruntime/qv4context.cpp5
-rw-r--r--src/qml/jsruntime/qv4context_p.h2
-rw-r--r--src/qml/qml/qqmltypeloader.cpp5
3 files changed, 9 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index 1f561e5f58..710c9e0ea2 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -570,3 +570,8 @@ QQmlContextData *QmlContext::qmlContext() const
{
return d()->qml->context;
}
+
+void QmlContext::takeContextOwnership() {
+ d()->qml->ownsContext = true;
+}
+
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index 63f8cbaac4..558630e945 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -225,6 +225,8 @@ struct QmlContext : public ExecutionContext
QObject *qmlScope() const;
QQmlContextData *qmlContext() const;
+
+ void takeContextOwnership();
};
inline CallContext *ExecutionContext::asCallContext()
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 5f30b83bbd..61aeae4b34 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -2539,8 +2539,7 @@ QV4::PersistentValue QQmlScriptData::scriptValueForContext(QQmlContextData *pare
}
QV4::Scoped<QV4::QmlContext> qmlContext(scope, v4->rootContext()->newQmlContext(ctxt, 0));
- QV4::Scoped<QV4::QmlContextWrapper> w(scope, qmlContext->d()->qml);
- w->takeContextOwnership();
+ qmlContext->takeContextOwnership();
m_program->qmlContext.set(scope.engine, qmlContext);
m_program->run();
@@ -2550,7 +2549,7 @@ QV4::PersistentValue QQmlScriptData::scriptValueForContext(QQmlContextData *pare
ep->warning(error);
}
- rv.set(scope.engine, w);
+ rv.set(scope.engine, qmlContext->d()->qml);
if (shared) {
m_value = rv;
m_loaded = true;