aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-11-08 21:28:30 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-09 15:34:39 +0900
commitf850a0817ccd37bc04945431aed58380e3edcad7 (patch)
treed8b7db02229fc4ee56103de9cb7759ddb23a70fd
parentd3fe3494fef7b43556bfd8bd3b2128a3e0dc623d (diff)
downloadsubsurface-f850a0817ccd37bc04945431aed58380e3edcad7.tar.gz
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>
-rw-r--r--qt-ui/diveplanner.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 39db8f431..c54cb9b19 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -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]);