mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
86ab5a91f7
commit
a76f15f0f6
1 changed files with 2 additions and 3 deletions
|
@ -425,13 +425,12 @@ void DiveListView::reload(DiveTripModel::Layout layout, bool forceSort)
|
||||||
|
|
||||||
QSortFilterProxyModel *m = qobject_cast<QSortFilterProxyModel *>(model());
|
QSortFilterProxyModel *m = qobject_cast<QSortFilterProxyModel *>(model());
|
||||||
QAbstractItemModel *oldModel = m->sourceModel();
|
QAbstractItemModel *oldModel = m->sourceModel();
|
||||||
if (oldModel) {
|
|
||||||
oldModel->deleteLater();
|
|
||||||
}
|
|
||||||
tripModel = new DiveTripModel(this);
|
tripModel = new DiveTripModel(this);
|
||||||
tripModel->setLayout(layout);
|
tripModel->setLayout(layout);
|
||||||
|
|
||||||
m->setSourceModel(tripModel);
|
m->setSourceModel(tripModel);
|
||||||
|
if (oldModel)
|
||||||
|
delete oldModel;
|
||||||
|
|
||||||
if (!forceSort)
|
if (!forceSort)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue