core/imagedownloader.cpp: Simplify deletion of objects

1) Destroying the QNetworkManager seems like a bug: this was a
subobject of ImageDonwloader. It's mysterious how this didn't
crash.

2) Instead of calling deleteLater() on the reply object, simply
delete it after completion.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-02-08 22:09:01 +01:00 committed by Lubomir I. Ivanov
parent c1cd2e0f02
commit 2803b7d385

View file

@ -41,6 +41,7 @@ void ImageDownloader::load(bool fromHash){
loop.processEvents(); loop.processEvents();
sleep(1); sleep(1);
} }
delete reply;
} }
} }
@ -69,8 +70,6 @@ void ImageDownloader::saveImage(QNetworkReply *reply)
add_hash(imageFile.fileName(), hash.result()); add_hash(imageFile.fileName(), hash.result());
learnHash(picture, hash.result()); learnHash(picture, hash.result());
} }
reply->manager()->deleteLater();
reply->deleteLater();
// This should be called to make the picture actually show. // This should be called to make the picture actually show.
// Problem is DivePictureModel is not in core. // Problem is DivePictureModel is not in core.
// Nevertheless, the image shows when the dive is selected the next time. // Nevertheless, the image shows when the dive is selected the next time.