From f8a773b37f408f309d92cd7b90845a81e0d642c3 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 28 May 2014 05:03:14 -0700 Subject: Dive planner: remember the selection before new dives get handled On an empty dive list we would remember the new dive (which gets auto-selected since it's the only dive) and then crash when we try to restore that selection after cancel (in which case that new dive is gone). Signed-off-by: Dirk Hohndel --- qt-ui/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qt-ui/mainwindow.cpp') diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index f2a2276be..8b012da90 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -378,9 +378,9 @@ void MainWindow::createFakeDiveForAddAndPlan() dive->longitude.udeg = 0; record_dive(dive); // select this new dive (but remember the old selection - ui.ListWidget->reload(DiveTripModel::CURRENT); ui.ListWidget->rememberSelection(); ui.ListWidget->unselectDives(); + ui.ListWidget->reload(DiveTripModel::CURRENT); ui.ListWidget->selectDives(QList() << dive_table.nr - 1); ui.InfoWidget->updateDiveInfo(selected_dive); } -- cgit v1.2.3-70-g09d2