aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-05-24 22:57:02 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2018-05-25 14:15:42 +0300
commita76f15f0f67c3f138362ec8c503f645dc1211cf5 (patch)
tree0a1f0c5f5e2052eb68c912495a269d507d80541a
parent86ab5a91f7d3b450e686c5a2cf8db8e4a8ff842e (diff)
downloadsubsurface-a76f15f0f67c3f138362ec8c503f645dc1211cf5.tar.gz
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>
-rw-r--r--desktop-widgets/divelistview.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp
index 0eea2b031..468daf5d1 100644
--- a/desktop-widgets/divelistview.cpp
+++ b/desktop-widgets/divelistview.cpp
@@ -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;