summaryrefslogtreecommitdiffstats
path: root/cli-downloader.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-26 18:45:46 +0100
committerGravatar Robert C. Helling <helling@atdotde.de>2021-01-26 20:20:09 +0100
commitdc887f6d0a55cd32c309ab5402e1e135b492c7df (patch)
tree7d65c04f760cbc062b3e8eb9235402801458ab2b /cli-downloader.cpp
parent5c9f3742ec73448b25d623db9436a4ea79e6ece6 (diff)
downloadsubsurface-dc887f6d0a55cd32c309ab5402e1e135b492c7df.tar.gz
downloader: don't leak DiveImportedModel
Not that it matters, but there seems to be no reason to allocate DiveImportedModel on the heap and no reason to leak it after the download has finished. Removes a artifactuous comment and fixes a typo. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'cli-downloader.cpp')
-rw-r--r--cli-downloader.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/cli-downloader.cpp b/cli-downloader.cpp
index 894ebfa2a..a6a880e29 100644
--- a/cli-downloader.cpp
+++ b/cli-downloader.cpp
@@ -3,13 +3,13 @@
void cliDownloader(const char *vendor, const char *product, const char *device)
{
- DiveImportedModel *diveImportedModel = new DiveImportedModel();
- DiveImportedModel::connect(diveImportedModel, &DiveImportedModel::downloadFinished, [] {
+ DiveImportedModel diveImportedModel;
+ DiveImportedModel::connect(&diveImportedModel, &DiveImportedModel::downloadFinished, [] {
// do something useful at the end of the download
printf("Finished\n");
});
- auto data = diveImportedModel->thread.data();
+ auto data = diveImportedModel.thread.data();
data->setVendor(vendor);
data->setProduct(product);
data->setBluetoothMode(false);
@@ -25,13 +25,12 @@ void cliDownloader(const char *vendor, const char *product, const char *device)
data->setDevName(device);
}
- // some assumptiond - should all be configurable
+ // some assumptions - should all be configurable
data->setForceDownload(false);
data->setSaveLog(true);
data->setSaveDump(false);
- // before we start, remember where the dive_table ended
- diveImportedModel->startDownload();
- diveImportedModel->waitForDownload();
- diveImportedModel->recordDives();
+ diveImportedModel.startDownload();
+ diveImportedModel.waitForDownload();
+ diveImportedModel.recordDives();
}