From 22c83af6ad9d0fe92568653e9950e21d087ad025 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 16 Jul 2015 06:40:16 -0700 Subject: Dive site handling: make sure the data in displayed_dive is updated After an edit when the dive is redisplayed we are not copying the data from current dive back over displayed dive (as the reasonable assumption is that we just edited the displayed dive and copied the information into the current dive)- so make sure that after the dive site handling the displayed dive does in fact have the correct dive site information. Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'qt-ui') diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 9b4166b35..f86991248 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -1067,6 +1067,15 @@ void MainTab::acceptChanges() updateDiveSite(get_idx_by_uniq_id(mydive->id)); ); + // the code above can change the correct uuid for the displayed dive site - and the + // code below triggers an update of the display without re-initializing displayed_dive + // so let's make sure here that our data is consistent now that we have handled the + // dive sites + displayed_dive.dive_site_uuid = current_dive->dive_site_uuid; + struct dive_site *ds = get_dive_site_by_uuid(displayed_dive.dive_site_uuid); + if (ds) + copy_dive_site(ds, &displayed_dive_site); + // each dive that was selected might have had the temperatures in its active divecomputer changed // so re-populate the temperatures - easiest way to do this is by calling fixup_dive for_each_dive (i, d) { -- cgit v1.2.3-70-g09d2