From a76f15f0f67c3f138362ec8c503f645dc1211cf5 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Thu, 24 May 2018 22:57:02 +0200 Subject: 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 Signed-off-by: Berthold Stoeger --- desktop-widgets/divelistview.cpp | 5 ++--- 1 file 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(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; -- cgit v1.2.3-70-g09d2