summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;