diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2014-04-24 13:16:57 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-04-25 07:19:18 -0700 |
commit | 6fe692bde62ba0c33de006c64a7c5b857bcd4007 (patch) | |
tree | 0938a2caa5af4cd7766492a36467c8dad1f2bdd2 /qt-ui | |
parent | 6378bfd91ee6c0ad746b072d8a9389e0eba7c614 (diff) | |
download | subsurface-6fe692bde62ba0c33de006c64a7c5b857bcd4007.tar.gz |
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>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/downloadfromdivecomputer.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp index 26635c6e8..a5b3d617c 100644 --- a/qt-ui/downloadfromdivecomputer.cpp +++ b/qt-ui/downloadfromdivecomputer.cpp @@ -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); } } |