From 411a213f65816677b09548c0c800bd643b7727c9 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Fri, 22 Sep 2023 00:44:13 +0300 Subject: [PATCH] QItemSelectionModel: remove some redundant code QObject::disconnect(connection) already sets connection.d_ptr to nullptr, and the default constructor only does that: QMetaObject::Connection::Connection() : d_ptr(nullptr) {} So calling disconnect() suffices in this case. Pick-to: 6.5 6.2 Change-Id: Icd5f9a15c83939eeecd9efb474ac3b38c0f2dfe4 Reviewed-by: Axel Spoerl (cherry picked from commit 3bac47336483d720c1d7376ea053c03a4e80173c) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/itemmodels/qitemselectionmodel.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp index 67868b19e1d..a558a0aa2fe 100644 --- a/src/corelib/itemmodels/qitemselectionmodel.cpp +++ b/src/corelib/itemmodels/qitemselectionmodel.cpp @@ -595,10 +595,8 @@ void QItemSelectionModelPrivate::initModel(QAbstractItemModel *m) void QItemSelectionModelPrivate::disconnectModel() { - for (auto &connection : connections) { + for (auto &connection : connections) QObject::disconnect(connection); - connection = QMetaObject::Connection(); - } } /*!