From 73b8bd12e54f5040051f929c20b4a5d9c6788a52 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 12 Oct 2018 09:15:36 +0200 Subject: 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 --- desktop-widgets/tab-widgets/maintab.cpp | 13 ++----------- 1 file 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(); -- cgit v1.2.3-70-g09d2