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>
This commit is contained in:
Berthold Stoeger 2021-01-26 18:45:46 +01:00 committed by Robert C. Helling
parent 5c9f3742ec
commit dc887f6d0a

View file

@ -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();
}