Fixes garbage left behind when canceling edit dive.

Garbage was left behind when canceling edit dive, and thus when the user
set his dive to be editted, after a first canceled edition, all points of
the first edition got messed up and showing on the second dive too. if the
user clicked 'ok', he got a really bad surprise.

Fixes #226

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-11-08 21:28:30 -02:00 committed by Dirk Hohndel
parent d3fe3494fe
commit f850a0817c

View file

@ -431,6 +431,13 @@ void DivePlannerPointsModel::loadFromDive(dive* d)
* as soon as the model is modified, it will
* remove all samples from the current dive.
* */
/* On the safe side, clear everything before
editing the new dive. */
beginRemoveRows(QModelIndex(), 0, rowCount()-1);
divepoints.clear();
endRemoveRows();
backupSamples.clear();
for(int i = 1; i < d->dc.samples-1; i++){
backupSamples.push_back( d->dc.sample[i]);