From 9d64da2fef62be237be964838ae9096f436ee7cd Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 24 Apr 2018 18:26:23 +0200 Subject: QQmlDelegateModel: include QQDMIncubationTask errors with our errors With the snippet in the referenced bug report (and the parent patch applied), the output is: qrc:/main.qml:19:19: QML ListView: Error creating delegate There should be more errors after this line, but since the delegate itself didn't have any errors, we need to also check with the incubation task. After doing so, the output becomes: qrc:/main.qml:19:19: QML ListView: Error creating delegate: qrc:/main.qml: Object destroyed during incubation This adds important context (for developers and for users reporting issues in the future) that was previously missing. Task-number: QTBUG-49224 Change-Id: Ic7ac1a06c7dbdf3746f960d28908cc10f6ae86f5 Reviewed-by: Simon Hausmann --- src/qml/types/qqmldelegatemodel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index c7351b654c..26c20d043f 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -877,6 +877,8 @@ void QQmlDelegateModelPrivate::incubatorStatusChanged(QQDMIncubationTask *incuba if (!isDoneIncubating(status)) return; + const QList incubationTaskErrors = incubationTask->errors(); + QQmlDelegateModelItem *cacheItem = incubationTask->incubating; cacheItem->incubationTask = nullptr; incubationTask->incubating = nullptr; @@ -890,7 +892,7 @@ void QQmlDelegateModelPrivate::incubatorStatusChanged(QQDMIncubationTask *incuba emitCreatedItem(incubationTask, cacheItem->object); cacheItem->releaseObject(); } else if (status == QQmlIncubator::Error) { - qmlWarning(m_delegate, m_delegate->errors()) << "Error creating delegate"; + qmlWarning(m_delegate, incubationTaskErrors + m_delegate->errors()) << "Error creating delegate"; } if (!cacheItem->isObjectReferenced()) { -- cgit v1.2.3