diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-09-20 14:53:53 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-20 22:14:19 +0200 |
commit | 5d7480aff029a8957170bcc36774225d6fb08eb7 (patch) | |
tree | 08d6cfe7a12c6657a6d9672b55ba9c7d168a1569 /src/qml/qml/qqmltypeloader.cpp | |
parent | 8514652f7d53013e7e14cd62ac054f32b907aeec (diff) |
[new compiler] Fix crash with remote imports
The import logic keeps pointers to the provided const QQmlImport references,
which means we can't pass references to temporaries when using the new code
path but for now have to keep the import objcts as member.
Change-Id: I75eff8dbe655ed23188f3f62f743a8f987bc709e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmltypeloader.cpp')
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 7b1935a447..6ccb8b3589 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -2102,9 +2102,8 @@ void QQmlTypeData::dataReceived(const Data &data) QList<QQmlError> errors; // ### convert to use new data structure once old compiler is gone. - QList<QQmlScript::Import> imports; - if (m_useNewCompiler) { - imports.reserve(parsedQML->imports.size()); + if (m_useNewCompiler && m_newImports.isEmpty()) { + m_newImports.reserve(parsedQML->imports.size()); foreach (QV4::CompiledData::Import *i, parsedQML->imports) { QQmlScript::Import import; import.uri = parsedQML->stringAt(i->uriIndex); @@ -2122,13 +2121,11 @@ void QQmlTypeData::dataReceived(const Data &data) } - imports << import; + m_newImports << import; } - } else { - imports = scriptParser.imports(); } - foreach (const QQmlScript::Import &import, imports) { + foreach (const QQmlScript::Import &import, m_useNewCompiler ? m_newImports : scriptParser.imports()) { if (!addImport(import, &errors)) { Q_ASSERT(errors.size()); QQmlError error(errors.takeFirst()); |