summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-28 05:03:14 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-28 10:12:33 -0700
commitf8a773b37f408f309d92cd7b90845a81e0d642c3 (patch)
tree09f8f1c918944f7c1044530f1196758878dad023
parent424d38e0c122308c068b3b67d51ad35bd5dcc403 (diff)
downloadsubsurface-f8a773b37f408f309d92cd7b90845a81e0d642c3.tar.gz
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 <dirk@hohndel.org>
-rw-r--r--qt-ui/mainwindow.cpp2
1 files changed, 1 insertions, 1 deletions
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<int>() << dive_table.nr - 1);
ui.InfoWidget->updateDiveInfo(selected_dive);
}