summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-10-23 18:55:42 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-29 00:09:31 +0000
commit8de471f90e95a5a75d0fec78d5bbf900eb90f235 (patch)
tree62812fb5aab9f6a8cb17db8969ab4e10eb041de0 /desktop-widgets
parent14ab95608cc0694caff580825666d2009177e0a2 (diff)
downloadsubsurface-8de471f90e95a5a75d0fec78d5bbf900eb90f235.tar.gz
Dive site: pass dive-site pointer to is_dive_site_used()
Instead of passing a uuid, pass a pointer to the dive site. This is small step in an effort to remove uuids. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/tab-widgets/maintab.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp
index e617a8140..3b727126a 100644
--- a/desktop-widgets/tab-widgets/maintab.cpp
+++ b/desktop-widgets/tab-widgets/maintab.cpp
@@ -713,7 +713,6 @@ uint32_t MainTab::updateDiveSite(uint32_t pickedUuid, dive *d)
return pickedUuid;
}
-
// Get the list of selected dives, but put the current dive at the last position of the vector
static QVector<dive *> getSelectedDivesCurrentLast()
{
@@ -880,18 +879,16 @@ void MainTab::acceptChanges()
}
// update the dive site for the selected dives that had the same dive site as the current dive
- uint32_t oldUuid = cd->dive_site_uuid;
+ struct dive_site *oldDs = get_dive_site_by_uuid(cd->dive_site_uuid);
uint32_t newUuid = 0;
MODIFY_DIVES(selectedDives,
if (mydive->dive_site_uuid == current_dive->dive_site_uuid)
newUuid = updateDiveSite(newUuid == 0 ? ui.location->currDiveSiteUuid() : newUuid, mydive);
);
- if (!is_dive_site_used(oldUuid, false)) {
- if (verbose) {
- struct dive_site *ds = get_dive_site_by_uuid(oldUuid);
- qDebug() << "delete now unused dive site" << ((ds && ds->name) ? ds->name : "without name");
- }
- delete_dive_site(oldUuid);
+ if (oldDs && !is_dive_site_used(oldDs, false)) {
+ if (verbose)
+ qDebug() << "delete now unused dive site" << (oldDs->name ? oldDs->name : "without name");
+ delete_dive_site(oldDs->uuid);
MapWidget::instance()->reload();
}
// the code above can change the correct uuid for the displayed dive site - and the