On Donnerstag, 24. Mai 2018 22:46:30 CEST Gaetan Bisson wrote: > [2018-05-23 07:20:43 -1000] Gaetan Bisson: > > Oh, it's also there: > > https://bugreports.qt.io/browse/QTBUG-67948 > > It turns out removing oldModel->deleteLater(); from DiveListView::reload() > avoids the segfault. See the discussion in the above bug report. However I > have no idea what the proper fix should be.
For one, we could delete it directly, c.f. attached patch. Probably it will still crash (no recent Qt to test, sorry), but at least we might get a useful back trace. deleteLater() is evil. Berthold
>From 479eccd89ae138ecab5bf6513d5ee5051137797e Mon Sep 17 00:00:00 2001 From: Berthold Stoeger <[email protected]> Date: Thu, 24 May 2018 22:57:02 +0200 Subject: [PATCH] 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. Signed-off-by: Berthold Stoeger <[email protected]> --- 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 659d8e842..999edd39c 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; -- 2.14.1
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
