diff options
-rw-r--r-- | src/gui/itemviews/qlistwidget.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qlistwidget/tst_qlistwidget.cpp | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp index 5dd1d76..929d688 100644 --- a/src/gui/itemviews/qlistwidget.cpp +++ b/src/gui/itemviews/qlistwidget.cpp @@ -176,7 +176,8 @@ void QListModel::move(int srcRow, int dstRow) || dstRow < 0 || dstRow >= items.count()) return; - beginMoveRows(QModelIndex(), srcRow, srcRow, QModelIndex(), dstRow); + if (!beginMoveRows(QModelIndex(), srcRow, srcRow, QModelIndex(), dstRow)) + return; if (srcRow < dstRow) --dstRow; items.move(srcRow, dstRow); diff --git a/tests/auto/qlistwidget/tst_qlistwidget.cpp b/tests/auto/qlistwidget/tst_qlistwidget.cpp index cb8f1e9..863c308 100644 --- a/tests/auto/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/qlistwidget/tst_qlistwidget.cpp @@ -867,6 +867,7 @@ void tst_QListWidget::moveItemsPriv_data() QTest::newRow("Same place") << 5 << 2 << 2 << false; QTest::newRow("Up") << 5 << 4 << 2 << true; QTest::newRow("Down") << 5 << 2 << 4 << true; + QTest::newRow("QTBUG-6532 assert") << 5 << 0 << 1 << false; } void tst_QListWidget::moveItemsPriv() |