diff options
Diffstat (limited to 'src/gui/text/qzip.cpp')
-rw-r--r-- | src/gui/text/qzip.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp index c6c2e69..04f081e 100644 --- a/src/gui/text/qzip.cpp +++ b/src/gui/text/qzip.cpp @@ -695,7 +695,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) @@ -711,7 +711,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; } @@ -969,7 +970,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) @@ -985,7 +986,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; } |