Merge lp:~michael-sheldon/ubuntu-download-manager/fix-1542853 into lp:ubuntu-download-manager

Proposed by Michael Sheldon
Status: Merged
Approved by: Bill Filler
Approved revision: 348
Merged at revision: 348
Proposed branch: lp:~michael-sheldon/ubuntu-download-manager/fix-1542853
Merge into: lp:ubuntu-download-manager
Diff against target: 42 lines (+16/-15)
1 file modified
src/downloads/priv/ubuntu/downloads/file_download.cpp (+16/-15)
To merge this branch: bzr merge lp:~michael-sheldon/ubuntu-download-manager/fix-1542853
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu Phablet Team Pending
Review via email: mp+285615@code.launchpad.net

Commit message

Clean up processed files even when processing fails

Description of the change

Clean up processed files even when processing fails

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/downloads/priv/ubuntu/downloads/file_download.cpp'
2--- src/downloads/priv/ubuntu/downloads/file_download.cpp 2015-12-23 13:28:57 +0000
3+++ src/downloads/priv/ubuntu/downloads/file_download.cpp 2016-02-10 14:56:35 +0000
4@@ -769,22 +769,23 @@
5 FileDownload::onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus) {
6 TRACE << exitCode << exitStatus;
7 auto p = qobject_cast<Process*>(sender());
8+ // remove the file since we are done with it
9+ cleanUpCurrentData();
10+ // remove the file because that is the contract that we have with
11+ // the clients
12+ auto fileMan = FileManager::instance();
13+
14+ if (fileMan->exists(_tempFilePath)) {
15+ LOG(INFO) << "Removing '" << _tempFilePath << "'";
16+ fileMan->remove(_tempFilePath);
17+ }
18+
19+ if (fileMan->exists(_filePath)) {
20+ LOG(INFO) << "Removing '" << _filePath << "'";
21+ fileMan->remove(_filePath);
22+ }
23+
24 if (exitCode == 0 && exitStatus == QProcess::NormalExit) {
25- // remove the file since we are done with it
26- cleanUpCurrentData();
27- // remove the file because that is the contract that we have with
28- // the clients
29- auto fileMan = FileManager::instance();
30-
31- if (fileMan->exists(_tempFilePath)) {
32- LOG(INFO) << "Removing '" << _tempFilePath << "'";
33- fileMan->remove(_tempFilePath);
34- }
35-
36- if (fileMan->exists(_filePath)) {
37- LOG(INFO) << "Removing '" << _filePath << "'";
38- fileMan->remove(_filePath);
39- }
40 emitFinished();
41 } else {
42 auto standardOut = p->readAllStandardOutput();

Subscribers

People subscribed via source and target branches