summaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp11
1 files changed, 7 insertions, 4 deletions
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();
}