From a988e3c135f8ad356b91edaede706770f5a3ab74 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 31 Mar 2021 13:54:23 +0200 Subject: core: initialize dive selection after resetting the data The dive selection was initialized during data-reset. However, this emitted a signal before all data-reset routines were run. Ultimately, this led to access-after-free in the statistics code. Instead, move the select_newest_visible_dive() signal from the divelist-model to the process_loaded_dives() function. There is no point in initializing the selection if the dive data is cleared after all. This change broke closing of the log, because the UI-selection was not reset. Therefore, when clearing the data, clear the selection before proceeding with clearing. Signed-off-by: Berthold Stoeger --- qt-models/divetripmodel.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'qt-models') diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp index 71430a7d3..939569522 100644 --- a/qt-models/divetripmodel.cpp +++ b/qt-models/divetripmodel.cpp @@ -499,7 +499,6 @@ void DiveTripModelBase::reset() uiNotification(tr("finish populating data store")); endResetModel(); uiNotification(tr("setting up internal data structures")); - initSelection(); emit diveListNotifier.numShownChanged(); uiNotification(tr("done setting up internal data structures")); } -- cgit v1.2.3-70-g09d2