Fix 'cancelling divecomputer download'

When a download is canceled, discard the partially downloaded dives.

Fixes #341

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-04-24 13:16:57 -03:00 committed by Dirk Hohndel
parent 6378bfd91e
commit 6fe692bde6

View file

@ -378,7 +378,13 @@ void DownloadFromDCWidget::onDownloadThreadFinished()
} else {
process_dives(true, preferDownloaded());
}
} else {
} else if (currentState == CANCELLING || currentState == CANCELLED){
if (import_thread_cancelled) {
// walk backwards so we don't keep moving the dives
// down in the dive_table
for (int i = dive_table.nr - 1; i >= previousLast; i--)
delete_single_dive(i);
}
updateState(CANCELLED);
}
}