diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-10-23 18:55:42 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-10-29 00:09:31 +0000 |
commit | 8de471f90e95a5a75d0fec78d5bbf900eb90f235 (patch) | |
tree | 62812fb5aab9f6a8cb17db8969ab4e10eb041de0 /desktop-widgets | |
parent | 14ab95608cc0694caff580825666d2009177e0a2 (diff) | |
download | subsurface-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.cpp | 13 |
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 |