diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-09-07 10:09:31 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-09-22 08:20:21 +0000 |
commit | 5322867e77426c2ad30e2efb13ebc4712c0c9772 (patch) | |
tree | 2f22c903355ce15e16e33d6f27eec780683b59d5 /src/qml/qml/qqmltypeloader.cpp | |
parent | ff347ccb093c8be4b44305516e644a17d01d6c30 (diff) |
Fix function signature
Returning a PersistentValue doesn't make much sense.
Change-Id: I6044a12e48aa835ef78008e070bacda5125a7ca7
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/qml/qqmltypeloader.cpp')
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 61aeae4b34..270c28c399 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -2471,12 +2471,10 @@ void QQmlScriptData::initialize(QQmlEngine *engine) addref(); } -QV4::PersistentValue QQmlScriptData::scriptValueForContext(QQmlContextData *parentCtxt) +QV4::ReturnedValue QQmlScriptData::scriptValueForContext(QQmlContextData *parentCtxt) { if (m_loaded) - return m_value; - - QV4::PersistentValue rv; + return m_value.value(); Q_ASSERT(parentCtxt && parentCtxt->engine); QQmlEnginePrivate *ep = QQmlEnginePrivate::get(parentCtxt->engine); @@ -2526,8 +2524,9 @@ QV4::PersistentValue QQmlScriptData::scriptValueForContext(QQmlContextData *pare } else { scriptsArray = ctxt->importedScripts.valueRef(); } + QV4::ScopedValue v(scope); for (int ii = 0; ii < scripts.count(); ++ii) - scriptsArray->putIndexed(ii, *scripts.at(ii)->scriptData()->scriptValueForContext(ctxt).valueRef()); + scriptsArray->putIndexed(ii, (v = scripts.at(ii)->scriptData()->scriptValueForContext(ctxt))); if (!hasEngine()) initialize(parentCtxt->engine); @@ -2535,7 +2534,7 @@ QV4::PersistentValue QQmlScriptData::scriptValueForContext(QQmlContextData *pare if (!m_program) { if (shared) m_loaded = true; - return QV4::PersistentValue(); + return QV4::Encode::undefined(); } QV4::Scoped<QV4::QmlContext> qmlContext(scope, v4->rootContext()->newQmlContext(ctxt, 0)); @@ -2549,13 +2548,13 @@ QV4::PersistentValue QQmlScriptData::scriptValueForContext(QQmlContextData *pare ep->warning(error); } - rv.set(scope.engine, qmlContext->d()->qml); + QV4::ScopedValue retval(scope, qmlContext->d()->qml); if (shared) { - m_value = rv; + m_value.set(scope.engine, retval); m_loaded = true; } - return rv; + return retval->asReturnedValue(); } void QQmlScriptData::clear() |