summaryrefslogtreecommitdiff
path: root/src/gui/text/qzip.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text/qzip.cpp')
-rw-r--r--src/gui/text/qzip.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp
index edef816151..13b98bd63c 100644
--- a/src/gui/text/qzip.cpp
+++ b/src/gui/text/qzip.cpp
@@ -705,7 +705,7 @@ void QZipWriterPrivate::addEntry(EntryType type, const QString &fileName, const
*/
QZipReader::QZipReader(const QString &archive, QIODevice::OpenMode mode)
{
- QFile *f = new QFile(archive);
+ QScopedPointer<QFile> f(new QFile(archive));
f->open(mode);
QZipReader::Status status;
if (f->error() == QFile::NoError)
@@ -721,7 +721,8 @@ QZipReader::QZipReader(const QString &archive, QIODevice::OpenMode mode)
status = FileError;
}
- d = new QZipReaderPrivate(f, /*ownDevice=*/true);
+ d = new QZipReaderPrivate(f.data(), /*ownDevice=*/true);
+ f.take();
d->status = status;
}
@@ -979,7 +980,7 @@ void QZipReader::close()
*/
QZipWriter::QZipWriter(const QString &fileName, QIODevice::OpenMode mode)
{
- QFile *f = new QFile(fileName);
+ QScopedPointer<QFile> f(new QFile(fileName));
f->open(mode);
QZipWriter::Status status;
if (f->error() == QFile::NoError)
@@ -995,7 +996,8 @@ QZipWriter::QZipWriter(const QString &fileName, QIODevice::OpenMode mode)
status = QZipWriter::FileError;
}
- d = new QZipWriterPrivate(f, /*ownDevice=*/true);
+ d = new QZipWriterPrivate(f.data(), /*ownDevice=*/true);
+ f.take();
d->status = status;
}