summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-10-12 09:15:36 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-13 21:41:41 -0400
commit73b8bd12e54f5040051f929c20b4a5d9c6788a52 (patch)
treefebccf5e3c552e01c2ccb962d43ae3ad044efd43
parent397e818be13f2ccdf12a6bf9f7b760f30a591b93 (diff)
downloadsubsurface-73b8bd12e54f5040051f929c20b4a5d9c6788a52.tar.gz
Dive edit: always use dive site of displayed_dive in updateDiveInfo
The old code had a special case for dive-editing mode: The dive site uuid of displayed_dive_site instead of displayed_dive was used. This makes no sense, because displayed_dive_site is only used by the dive-site-edit widget, which firstly cannot be activated during dive-edit and secondly doesn't change the dive site id anyway. Thus, use the dive site of the currently edited/displayed dive in all cases. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r--desktop-widgets/tab-widgets/maintab.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp
index 31f7f3ff3..1a024686b 100644
--- a/desktop-widgets/tab-widgets/maintab.cpp
+++ b/desktop-widgets/tab-widgets/maintab.cpp
@@ -415,20 +415,11 @@ void MainTab::updateDiveInfo(bool clear)
if (!clear) {
struct dive_site *ds = NULL;
- // if we are showing a dive and editing it, let's refer to the displayed_dive_site as that
- // already may contain changes, otherwise start with the dive site referred to by the displayed
- // dive
- if (rememberEM == DIVE) {
- ds = &displayed_dive_site;
- } else {
- ds = get_dive_site_by_uuid(displayed_dive.dive_site_uuid);
- if (ds)
- copy_dive_site(ds, &displayed_dive_site);
- }
-
+ ds = get_dive_site_by_uuid(displayed_dive.dive_site_uuid);
if (ds) {
ui.location->setCurrentDiveSiteUuid(ds->uuid);
ui.locationTags->setText(constructLocationTags(ds, true));
+ copy_dive_site(ds, &displayed_dive_site);
} else {
ui.location->clear();
ui.locationTags->clear();