diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 7936eb78e4e..41888727c06 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -322,13 +322,13 @@ void tst_QComboBox::getSetCheck() // QAbstractItemDelegate * QComboBox::itemDelegate() // void QComboBox::setItemDelegate(QAbstractItemDelegate *) - MyAbstractItemDelegate *var10 = new MyAbstractItemDelegate; - obj1.setItemDelegate(var10); - QCOMPARE(obj1.itemDelegate(), var10); + auto var10 = std::make_unique(); + obj1.setItemDelegate(var10.get()); + QCOMPARE(obj1.itemDelegate(), var10.get()); QTest::ignoreMessage(QtWarningMsg, "QComboBox::setItemDelegate: cannot set a 0 delegate"); obj1.setItemDelegate((QAbstractItemDelegate *)0); - QCOMPARE(obj1.itemDelegate(), var10); - // delete var10; // No delete, since QComboBox takes ownership + QCOMPARE(obj1.itemDelegate(), var10.get()); + var10.reset(); // QAbstractItemModel * QComboBox::model() // void QComboBox::setModel(QAbstractItemModel *)