From f850a0817ccd37bc04945431aed58380e3edcad7 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Fri, 8 Nov 2013 21:28:30 -0200 Subject: 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 --- qt-ui/diveplanner.cpp | 7 +++++++ 1 file changed, 7 insertions(+) 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]); -- cgit v1.2.3-70-g09d2