Details
-
Bug
-
Resolution: Duplicate
-
P1: Critical
-
5.3.0 RC1, 5.12
-
None
-
Mac 5.2.1 , Linux 5.3
Description
Hi,
I want to report a crash issue for ListModel with dynamicRoles enabled. The following code has demonstrated the problem. All the test is passed, but the program crashes on termination. It has been tested on Mac (5.2.1) and Linux (5.3.0 RC. Released on 2rd May). Both of the platform show the same problem.
The purpose of this code is just to show different way to call the method of item in ListModel. Although it is not production code , I think Qt should not crashes by pure Javascript code.
The program will not crash if you turn off the dynamicRoles property . The result will be all green.
Thank you.
import QtQuick 2.0 import QtTest 1.0 TestCase { name : "QML" Item { id : testItem property string name : "testObject" property var object : this function testMethod() { return -1; } } ListModel { id : listModel dynamicRoles : true } function test_ListModel() { listModel.append(testItem); compare(listModel.count , 1); var data = listModel.get(0); compare(data !== testItem, true); compare(data.name , "testObject"); compare(typeof data.testMethod !== "function", true); compare(typeof data.object.testMethod , "function"); compare(data.object.testMethod() , -1); listModel.clear(); listModel.append({ item : testItem }); data = listModel.get(0); compare(data.item === testItem, true); compare(data.item.name , "testObject"); compare(typeof data.item.testMethod , "function"); } }
The backtrack
0 QMetaObject::cast(QObject*) const QMetaObject::cast(QObject*) const 0x100bc2b6e 1 QtPrivate::QVariantValueHelper<QObject*>::object(QVariant const&) QtPrivate::QVariantValueHelper<QObject*>::object(QVariant const&) 0x10040d4ae 2 DynamicRoleModelNodeMetaObject::~DynamicRoleModelNodeMetaObject() DynamicRoleModelNodeMetaObject::~DynamicRoleModelNodeMetaObject() 0x10066e8b5 3 DynamicRoleModelNodeMetaObject::~DynamicRoleModelNodeMetaObject() DynamicRoleModelNodeMetaObject::~DynamicRoleModelNodeMetaObject() 0x10066e83e 4 QObjectPrivate::~QObjectPrivate() QObjectPrivate::~QObjectPrivate() 0x100be4a8d 5 QObjectPrivate::~QObjectPrivate() QObjectPrivate::~QObjectPrivate() 0x100be49af 6 QObject::~QObject() QObject::~QObject() 0x100be6574 7 DynamicRoleModelNode::~DynamicRoleModelNode() DynamicRoleModelNode::~DynamicRoleModelNode() 0x10067516e 8 QQmlListModel::~QQmlListModel() QQmlListModel::~QQmlListModel() 0x10066f294 9 QQmlPrivate::QQmlElement<QQmlListModel>::~QQmlElement() QQmlPrivate::QQmlElement<QQmlListModel>::~QQmlElement() 0x100560814 10 QObjectPrivate::deleteChildren() QObjectPrivate::deleteChildren() 0x100be674e 11 QObject::~QObject() QObject::~QObject() 0x100be6554 12 QQmlPrivate::QQmlElement<QQuickItem>::~QQmlElement() QQmlPrivate::QQmlElement<QQuickItem>::~QQmlElement() 0x1000f0aeb 13 QQuickView::~QQuickView() QQuickView::~QQuickView() 0x100167cfe 14 QQuickView::~QQuickView() QQuickView::~QQuickView() 0x100167c5e 15 quick_test_main(int, char**, char const*, char const*) quick_test_main(int, char**, char const*, char const*) 0x1014271f7 16 main main.cpp 12 0x10000433d
Completed program has been attached.
Attachments
Issue Links
- duplicates
-
QTBUG-35639 DynamicRoleModel is unsafe
- Closed
For Gerrit Dashboard: QTBUG-38907 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
88632,1 | QQmlListModel: Add a test case to prove the fix for QTBUG-38907 | dev | qt/qtdeclarative | Status: ABANDONED | 0 | 0 |