Don't call QSet::erase() on an end iterator
hash.erase(hash.constFind()) is bound to crash if the hash doesn't contain the item we're looking for. Change-Id: Icbefca87b0258970373ec55d5dc113e6ab39c5f0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>bb10
parent
c269d8f086
commit
7b5e4b6944
|
|
@ -951,7 +951,9 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent,
|
|||
for (QVector<QPersistentModelIndexData *>::const_iterator it = persistent_invalidated.constBegin();
|
||||
it != persistent_invalidated.constEnd(); ++it) {
|
||||
QPersistentModelIndexData *data = *it;
|
||||
persistent.indexes.erase(persistent.indexes.constFind(data->index));
|
||||
auto index = persistent.indexes.constFind(data->index);
|
||||
if (index != persistent.indexes.constEnd())
|
||||
persistent.indexes.erase(index);
|
||||
data->index = QModelIndex();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3150,7 +3150,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
|
|||
for (int i = 0; i < childList.count(); ++i) {
|
||||
QStandardItem *chi = childList.at(i);
|
||||
if (chi) {
|
||||
itemsSet.erase(itemsSet.constFind(chi));
|
||||
itemsSet.remove(chi);
|
||||
stack.push(chi);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue