diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-02-10 16:27:05 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-02-10 16:27:05 -0800 |
commit | ba6713f0d89e5e5a8f882ca946227fdfd4154447 (patch) | |
tree | 1e9e4dcfc0eee8d75077679d20d80de931cfe63e | |
parent | 74c75938bf9033f28d628c6b911e0ddc2113ed6c (diff) | |
download | subsurface-ba6713f0d89e5e5a8f882ca946227fdfd4154447.tar.gz |
Clean up the setDive function
* This should never be called with a NULL dive.
* The dc variable was set then never used.
* We now have a unique id for each dive, but we can't simply not
repopulate the model in setDive as the old comment might make you
consider, as otherwise the dataModel will reference already freed data
in pInfo.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-ui/profile/diveplotdatamodel.cpp | 7 | ||||
-rw-r--r-- | qt-ui/profile/diveplotdatamodel.h | 2 |
2 files changed, 2 insertions, 7 deletions
diff --git a/qt-ui/profile/diveplotdatamodel.cpp b/qt-ui/profile/diveplotdatamodel.cpp index a754b0e79..94a8af5ba 100644 --- a/qt-ui/profile/diveplotdatamodel.cpp +++ b/qt-ui/profile/diveplotdatamodel.cpp @@ -106,13 +106,8 @@ void DivePlotDataModel::clear() void DivePlotDataModel::setDive(dive* d, const plot_info& info) { - // We need a way to find out if the dive setted is the same old dive, but pointers change, - // and there's no UUID, for now, just repopulate everything. clear(); - struct divecomputer *dc = NULL; - - if (d) - dc = select_dc(&d->dc); + Q_ASSERT(d != NULL); diveId = d->id; pInfo = info; beginInsertRows(QModelIndex(), 0, pInfo.nr-1); diff --git a/qt-ui/profile/diveplotdatamodel.h b/qt-ui/profile/diveplotdatamodel.h index e84645b40..47ebe03e0 100644 --- a/qt-ui/profile/diveplotdatamodel.h +++ b/qt-ui/profile/diveplotdatamodel.h @@ -34,4 +34,4 @@ private: int diveId; }; -#endif
\ No newline at end of file +#endif |