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.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 6f9be07b8..b3514e4f2 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -843,14 +843,20 @@ void MainTab::rejectChanges()
}
}
// now let's avoid memory leaks
- struct dive *cd = current_dive;
- FREE_IF_DIFFERENT(tag_list);
- FREE_IF_DIFFERENT(location);
- FREE_IF_DIFFERENT(buddy);
- FREE_IF_DIFFERENT(divemaster);
- FREE_IF_DIFFERENT(notes);
- FREE_IF_DIFFERENT(suit);
-
+ if (MainWindow::instance() && MainWindow::instance()->dive_list()->selectedTrips().count() == 1) {
+ if (editedDive.location != current_dive->divetrip->location)
+ free(editedDive.location);
+ if (editedDive.notes != current_dive->divetrip->notes)
+ free(editedDive.notes);
+ } else {
+ struct dive *cd = current_dive;
+ FREE_IF_DIFFERENT(tag_list);
+ FREE_IF_DIFFERENT(location);
+ FREE_IF_DIFFERENT(buddy);
+ FREE_IF_DIFFERENT(divemaster);
+ FREE_IF_DIFFERENT(notes);
+ FREE_IF_DIFFERENT(suit);
+ }
hideMessage();
MainWindow::instance()->dive_list()->setEnabled(true);
ui.dateEdit->setEnabled(true);