From 4585889467b6124f2e9ccca3d1c0da15e2bf790c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 19 Jul 2017 14:16:26 +0200 Subject: Fix race condition in the processEvents test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test verifies processEvents(WaitForMoreEvents) behavior by first processing all pending events (in a loop) and then verifying that a following processEvents call actually waits. But there is no guarantee that the OS won’t introduce more events after the first loop has completed. This does indeed seem to happen on recent versions of macOS. Change the test to not require that the processEvents call blocked and de-blacklist. Task-number: QTBUG-61131 Change-Id: Ic8fa74a6085165442791264f6f137a2fa6083138 Reviewed-by: Tor Arne Vestbø --- tests/auto/gui/kernel/qguieventloop/BLACKLIST | 2 -- 1 file changed, 2 deletions(-) (limited to 'tests/auto/gui') diff --git a/tests/auto/gui/kernel/qguieventloop/BLACKLIST b/tests/auto/gui/kernel/qguieventloop/BLACKLIST index 2303d9380e..03acb2f5b0 100644 --- a/tests/auto/gui/kernel/qguieventloop/BLACKLIST +++ b/tests/auto/gui/kernel/qguieventloop/BLACKLIST @@ -1,4 +1,2 @@ -[processEvents] -osx-10.12 [testQuitLock] osx-10.12 -- cgit v1.2.3 From 763b0a68beb3b1502f6f4c1b979f0a576fc9980b Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Tue, 20 Jun 2017 12:51:40 +0200 Subject: Fix QStandardItem::setChild crash when passing a null pointer Passing a null pointer as a parameter to the setChild function no longer crashes when calling the QStandardItemModelPrivate::itemChanged signal. The child is removed from the model. The patch also fixes the behavior of deleting a item. A dataChanged signal is emitted. Change-Id: I027e8b0d84fe33c5fca056df870f0e60a020824b Reviewed-by: David Faure --- .../qstandarditemmodel/tst_qstandarditemmodel.cpp | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests/auto/gui') diff --git a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp index cff26be7bb..2f5537adfe 100644 --- a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp +++ b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp @@ -117,6 +117,9 @@ private slots: void useCase2(); void useCase3(); + void setNullChild(); + void deleteChild(); + void rootItemFlags(); #ifdef QT_BUILD_INTERNAL void treeDragAndDrop(); @@ -1364,6 +1367,30 @@ void tst_QStandardItemModel::useCase3() delete childItem; } +void tst_QStandardItemModel::setNullChild() +{ + QStandardItemModel model; + model.setColumnCount(2); + createChildren(&model, model.invisibleRootItem(), 0); + QStandardItem *item = model.item(0); + QSignalSpy spy(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector))); + item->setChild(0, nullptr); + QCOMPARE(item->child(0), nullptr); + QCOMPARE(spy.count(), 1); +} + +void tst_QStandardItemModel::deleteChild() +{ + QStandardItemModel model; + model.setColumnCount(2); + createChildren(&model, model.invisibleRootItem(), 0); + QStandardItem *item = model.item(0); + QSignalSpy spy(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector))); + delete item->child(0); + QCOMPARE(item->child(0), nullptr); + QCOMPARE(spy.count(), 1); +} + void tst_QStandardItemModel::rootItemFlags() { QStandardItemModel model(6, 4); -- cgit v1.2.3