mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
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>
This commit is contained in:
parent
74c75938bf
commit
ba6713f0d8
2 changed files with 2 additions and 7 deletions
|
@ -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);
|
||||
|
|
|
@ -34,4 +34,4 @@ private:
|
|||
int diveId;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue