summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--divelist.c4
-rw-r--r--qt-ui/maintab.cpp11
2 files changed, 9 insertions, 6 deletions
diff --git a/divelist.c b/divelist.c
index 777c53ba2..d5ee9b71a 100644
--- a/divelist.c
+++ b/divelist.c
@@ -883,11 +883,11 @@ void delete_single_dive(int idx)
if (!dive)
return; /* this should never happen */
remove_dive_from_trip(dive);
+ if (dive->selected)
+ deselect_dive(idx);
for (i = idx; i < dive_table.nr - 1; i++)
dive_table.dives[i] = dive_table.dives[i+1];
dive_table.dives[--dive_table.nr] = NULL;
- if (dive->selected)
- amount_selected--;
/* free all allocations */
free(dive->dc.sample);
if (dive->location)
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 6a3d46a99..d9249046f 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -469,6 +469,11 @@ void MainTab::rejectChanges()
ui->notes->setText(notesBackup[NULL].notes );
ui->location->setText(notesBackup[NULL].location);
}else{
+ if (editMode == ADD) {
+ // clean up
+ delete_single_dive(selected_dive);
+ DivePlannerPointsModel::instance()->cancelPlan();
+ }
struct dive *curr = current_dive;
ui->notes->setText(notesBackup[curr].notes );
ui->location->setText(notesBackup[curr].location);
@@ -520,10 +525,8 @@ void MainTab::rejectChanges()
ui->watertemp->setPalette(p);
ui->dateTimeEdit->setPalette(p);
if (editMode == ADD) {
- // clean up
- delete_single_dive(selected_dive);
- selected_dive = -1;
- DivePlannerPointsModel::instance()->cancelPlan();
+ // more clean up
+ updateDiveInfo(selected_dive);
mainWindow()->showProfile();
mainWindow()->refreshDisplay();
}