diff options
author | Andrew den Exter <andrew.den.exter@jollamobile.com> | 2013-11-21 11:15:59 +1000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-24 01:44:43 +0100 |
commit | f0d2857271a2e619d6ede54a6855326e9232fd12 (patch) | |
tree | 70bd096377d5569bcaadb3704d3bd931692ed9f7 /src/qml/util | |
parent | 85fea8a68b90c817c47022ca5157ff80cb497d4d (diff) |
Fix crash when assigning a null QObject or derived property as a ListView model
Fall through to the null case handler in the event of a QVariant of QObject or
derived type with a null value, rather than asserting in the instance handler.
Task-number: QTBUG-34999
Change-Id: I5eeffbe29a263c57e6157d516b138ddc8e2e7a95
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'src/qml/util')
-rw-r--r-- | src/qml/util/qqmladaptormodel.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp index 9cd5709a49..38fdffdde6 100644 --- a/src/qml/util/qqmladaptormodel.cpp +++ b/src/qml/util/qqmladaptormodel.cpp @@ -902,7 +902,7 @@ void QQmlAdaptorModel::setModel(const QVariant &variant, QQmlDelegateModel *vdm, list.setList(variant, engine); - if (QObject *object = qvariant_cast<QObject *>(variant)) { + if (QObject *object = qvariant_cast<QObject *>(list.list())) { setObject(object); if (QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(object)) { accessors = new VDMAbstractItemModelDataType(this); @@ -927,8 +927,8 @@ void QQmlAdaptorModel::setModel(const QVariant &variant, QQmlDelegateModel *vdm, } else if (list.type() == QQmlListAccessor::ListProperty) { setObject(static_cast<const QQmlListReference *>(variant.constData())->object()); accessors = new VDMObjectDelegateDataType; - } else if (list.type() != QQmlListAccessor::Invalid) { - Q_ASSERT(list.type() != QQmlListAccessor::Instance); // Should have cast to QObject. + } else if (list.type() != QQmlListAccessor::Invalid + && list.type() != QQmlListAccessor::Instance) { // Null QObject setObject(0); accessors = &qt_vdm_list_accessors; } else { |