From 7a6ff7a53cc23c2129fb5f4d4046acf71404b087 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 17 Nov 2013 14:37:10 -0800 Subject: Fix a couple of problems with dive merging - Dive list no longer has messed up trip entries - Dive list is now correctly marked as modified after trips are merged - When data file is closed, the list of selected trips is cleared which avoids a potential crash when loading a new data file Fixes #286 Signed-off-by: Dirk Hohndel --- qt-ui/divelistview.cpp | 4 ++++ qt-ui/mainwindow.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 9779d60e7..b0045b765 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -437,7 +437,11 @@ void DiveListView::merge_trip(const QModelIndex &a, int offset) trip_a->notes = strdup(trip_b->notes); while (trip_b->dives) add_dive_to_trip(trip_b->dives, trip_a); + rememberSelection(); reload(currentLayout, false); + fixMessyQtModelBehaviour(); + restoreSelection(); + mark_divelist_changed(TRUE); } void DiveListView::mergeTripAbove() diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 183143aff..8628ca558 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -145,6 +145,7 @@ void MainWindow::on_actionClose_triggered() while (dive_table.nr) delete_single_dive(0); + dive_list()->selectedTrips.clear(); /* clear the selection and the statistics */ selected_dive = -1; -- cgit v1.2.3-70-g09d2