diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-09-08 11:05:20 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-12 23:00:19 +0200 |
commit | 346662cb011b7962a8cabf6d55742cd050a6ba6c (patch) | |
tree | ef71f9e15cfb6816c793eff5c9c097cf2d121ff9 /src/qml/qml/qqmltypeloader.cpp | |
parent | 845b07dad47e63bf285461433f4321d71c6c343d (diff) |
Fix error reporting timing
Errors for example in signal declarations are usually reported in the loader
thread, during property cache construction. This patch separates out the
property cache population into QQmlPropertyCacheCreator, runs it from the
loader thread and reduces the QQmlObjectCreator to merely set the properties/bindings/
functions on the object.
This also enables location tracking for signal declarations and their error reporting.
Change-Id: Ief1ffbb3113f8279a50d1a12dab8dbe096702a60
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmltypeloader.cpp')
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 8c3826b6df..0f83da7b0a 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -2189,6 +2189,39 @@ void QQmlTypeData::compile() if (m_compiledData->compilationUnit) m_compiledData->compilationUnit->ref(); m_compiledData->qmlUnit = qmlUnit; // ownership transferred to m_compiledData + + QList<QQmlError> errors; + + m_compiledData->datas.reserve(qmlUnit->nObjects); + m_compiledData->propertyCaches.reserve(qmlUnit->nObjects); + + QQmlPropertyCacheCreator propertyCacheBuilder(QQmlEnginePrivate::get(m_typeLoader->engine()), + qmlUnit, m_compiledData->url, m_compiledData->importCache, + &m_imports); + + for (quint32 i = 0; i < qmlUnit->nObjects; ++i) { + const QV4::CompiledData::Object *obj = qmlUnit->objectAt(i); + + QByteArray vmeMetaObjectData; + QQmlPropertyCache *propertyCache = 0; + + if (!propertyCacheBuilder.create(obj, &propertyCache, &vmeMetaObjectData)) { + errors << propertyCacheBuilder.errors; + break; + } + + Q_ASSERT(propertyCache); + + m_compiledData->datas << vmeMetaObjectData; + propertyCache->addref(); + m_compiledData->propertyCaches << propertyCache; + } + + if (!errors.isEmpty()) { + setError(errors); + m_compiledData->release(); + m_compiledData = 0; + } } else { QQmlCompiler compiler(&scriptParser._pool); if (!compiler.compile(typeLoader()->engine(), this, m_compiledData)) { |