From 2bdfd7296382ce5ea0965975d2115a5ce0697d06 Mon Sep 17 00:00:00 2001 From: "craig.p.drummond" Date: Thu, 13 Feb 2014 19:10:57 +0000 Subject: [PATCH] Closing files should be enough - so no need for size check --- ChangeLog | 4 ++-- devices/device.cpp | 2 +- devices/mtpdevice.cpp | 5 ----- gui/coverdialog.cpp | 4 ---- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index dc50dd815..8d858aa81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -132,8 +132,8 @@ 79. When downloading, and parsing, ListLive streams, if a station has more than 1 stream then list all streams - adding format and bitrate 80. Move search fields back to the top of views. -81. Check sizes of temporary files after write, to ensure data is written. This - fixes an issue where sometimes 0 byte files were written from CoverDialog. +81. Close temporary files after write, to ensure data is written. This fixes an + issue where sometimes 0 byte files were written from CoverDialog. 1.2.2 ----- diff --git a/devices/device.cpp b/devices/device.cpp index 13a5dbb72..a8a79c0f5 100644 --- a/devices/device.cpp +++ b/devices/device.cpp @@ -270,7 +270,7 @@ QTemporaryFile * Device::copySongToTemp(Song &song) if (QFile::exists(temp->fileName())) { QFile::remove(temp->fileName()); // Copy will *not* overwrite file! } - if (!QFile::copy(song.file, temp->fileName()) || temp->size()<=0) { + if (!QFile::copy(song.file, temp->fileName())) { temp->remove(); delete temp; temp=0; diff --git a/devices/mtpdevice.cpp b/devices/mtpdevice.cpp index b2404a1ad..000a98675 100644 --- a/devices/mtpdevice.cpp +++ b/devices/mtpdevice.cpp @@ -858,11 +858,6 @@ static QTemporaryFile * saveImageToTemp(const QImage &img, const QString &name) } img.save(temp); temp->close(); - if (temp->size()<=0) { - temp->remove(); - delete temp; - temp=0; - } return temp; } diff --git a/gui/coverdialog.cpp b/gui/coverdialog.cpp index 82a1462f9..56da94598 100644 --- a/gui/coverdialog.cpp +++ b/gui/coverdialog.cpp @@ -568,10 +568,6 @@ void CoverDialog::downloadJobFinished() delete last; } temp->close(); - if (temp->size()<=0) { - delete temp; - temp=0; - } temp->setProperty(constLargeProperty, reply->property(constLargeProperty)); tempFiles.prepend(temp); } else {