From 9b4cfa4a3dfd95733766836ad4b424806040ed4a Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Fri, 6 Nov 2009 13:19:49 +0000 Subject: [PATCH] - Close the file before emitting the signal so that the file can safely be processed in the slot --- src/downloadThread.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/downloadThread.cpp b/src/downloadThread.cpp index 8dc87f490..2c83dbd8a 100644 --- a/src/downloadThread.cpp +++ b/src/downloadThread.cpp @@ -62,13 +62,14 @@ void downloadThread::processDlFinished(QNetworkReply* reply) { if(reply->open(QIODevice::ReadOnly)) { tmpfile.write(reply->readAll()); reply->close(); + tmpfile.close(); // Send finished signal emit downloadFinished(url, filePath); } else { // Error when reading the request + tmpfile.close(); emit downloadFailure(url, tr("I/O Error")); } - tmpfile.close(); } else { emit downloadFailure(url, tr("I/O Error")); }