Bug? Appending two items to a QML ListModel, then model.move(1,0,1); causes crash.
-
I think the code snippet below is enough to demonstrate the bug I think I've found. If I have a ListModel in QML and I insert() two items at the beginning of the list, then move the second item to the beginning of the list, it works correctly. However, when I have an empty list and add two items to the list using the append() command instead, then use the move(1,0,1) command to move the second element to the top of the list, it crashes.
@ ListModel {
id: alertModel
}Component.onCompleted: { var data1 = { 'alertDescription' : "Alert #1", 'alertType' : 2, 'acknowledged' : false, 'alertState' : "yellow", 'alertId' : 0 }; var data2 = { 'alertDescription' : "Alert #2", 'alertType' : 3, 'acknowledged' : false, 'alertState' : "red", 'alertId' : 1 };
// alertModel.insert(0, data1);
// alertModel.insert(0, data2);
alertModel.append(data1);
alertModel.append(data2);
alertModel.move(1,0,1);
}@The specific command-line crash info is as follows:
"ASSERT: "!isEmpty()" in file ../../include/QtCore/../../src/corelib/tools/qlist.h, line 282" a few lines down it says "LEAK: 231 Structure".I'm using Qt code 4.7.4, with the latest 4.7 updates. I know it's not 4.8.1, but I'm choosing not to use that version because it crashes when qmlviewer.exe can't find an exported C++ library, rather than gracefully refusing.