diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-10-27 15:18:29 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-10-29 00:09:31 +0000 |
commit | e8b3fdb4a6936c1130395e039963839d64f2b396 (patch) | |
tree | cce9f8dbba5dd3b492a88a8fa4a2462665b453bb /qt-models | |
parent | 724055f0af4fb7cdb9f1570967fe4b34797f3419 (diff) | |
download | subsurface-e8b3fdb4a6936c1130395e039963839d64f2b396.tar.gz |
Dive site: compare pointers in MultiFilterSortModel::showDive()
To test whether to show a dive, the UUIDs of the filtered-by
location and the dive-site of a dive were compared. Since UUIDs
are unique (as the name implies), directly compare pointers.
Note: this code comes from a time when the filtered-by location
was not a pointer, but a copy.
Moreover, the if tested first for the same name, then (logical-or)
for the same uuid. This makes no sense, as the same dive-site
implies the same name. This code likewise can be explained by
historic reasons: the filtered-by location may have contained
a different name. Swap the order of the conditions: first test
for the same object and only of the objects differ, test for
the same same.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/filtermodels.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/qt-models/filtermodels.cpp b/qt-models/filtermodels.cpp index 1d6830ee0..ce0c2528c 100644 --- a/qt-models/filtermodels.cpp +++ b/qt-models/filtermodels.cpp @@ -592,7 +592,7 @@ bool MultiFilterSortModel::showDive(const struct dive *d) const dive_site *ds = d->dive_site; if (!ds) return false; - return same_string(ds->name, curr_dive_site->name) || ds->uuid == curr_dive_site->uuid; + return ds == curr_dive_site || same_string(ds->name, curr_dive_site->name); } if (models.isEmpty()) |