Cleanup: Don't defer deletion of oldModel in DiveListView::reload()

There seems to be no point in using deleteLater() of the previous
model. Set the new model and delete the old one.

This fixes a crash with Qt 5.11.

Tested-by: Gaetan Bisson <bisson@archlinux.org>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-05-24 22:57:02 +02:00 committed by Lubomir I. Ivanov
parent 86ab5a91f7
commit a76f15f0f6

View file

@ -425,13 +425,12 @@ void DiveListView::reload(DiveTripModel::Layout layout, bool forceSort)
QSortFilterProxyModel *m = qobject_cast<QSortFilterProxyModel *>(model());
QAbstractItemModel *oldModel = m->sourceModel();
if (oldModel) {
oldModel->deleteLater();
}
tripModel = new DiveTripModel(this);
tripModel->setLayout(layout);
m->setSourceModel(tripModel);
if (oldModel)
delete oldModel;
if (!forceSort)
return;