summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io/qfile.cpp')
-rw-r--r--src/corelib/io/qfile.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index d08574d..cdee7ce 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -918,6 +918,7 @@ QFile::copy(const QString &newName)
#endif
if (error) {
out.close();
+ close();
d->setError(QFile::CopyError, tr("Cannot open for output"));
} else {
char block[4096];
@@ -928,6 +929,7 @@ QFile::copy(const QString &newName)
break;
totalRead += in;
if(in != out.write(block, in)) {
+ close();
d->setError(QFile::CopyError, tr("Failure to write block"));
error = true;
break;
@@ -941,6 +943,7 @@ QFile::copy(const QString &newName)
}
if (!error && !out.rename(newName)) {
error = true;
+ close();
d->setError(QFile::CopyError, tr("Cannot create %1 for output").arg(newName));
}
#ifdef QT_NO_TEMPORARYFILE
@@ -951,10 +954,10 @@ QFile::copy(const QString &newName)
out.setAutoRemove(false);
#endif
}
- close();
}
if(!error) {
QFile::setPermissions(newName, permissions());
+ close();
unsetError();
return true;
}