QFile::close() doesn't return a value, but sets an error string instead,
we need to check for that and set it in KCompressionDevice so apps can check for that in turn.
Details
Saving into /tmp/mnt/test.gz with kate, with the setup described in
https://phabricator.kde.org/D14890
Diff Detail
- Repository
- R243 KArchive
- Branch
- master
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 1968 Build 1986: arc lint + arc unit
Propagating the error is good in any case.
Will later adapt my patch to use it, like you proposed.
Still, my crash does happen independent of this I assume.
Hmm, actually, that has other issues.
You can't check errorString().isEmpty() for checking if an error is there.
I just commited my other patch with the addition of that code (and was to dumb to run make test)
e.g. even after constructing a QFile, you already have:
const KCompressionDevice::CompressionType type = KFilterDev::compressionTypeForMimeType(m_mimeTypeForFilterDev); QScopedPointer<QIODevice> saveFile((type == KCompressionDevice::None) ? static_cast<QIODevice*>(new QFile(filename)) : static_cast<QIODevice*>(new KCompressionDevice(filename, type)));
qDebug() << "lalal file " << filename << "failed with error" << saveFile->errorString();
>
lalal file "/home/cullmann/kde/build/frameworks/ktexteditor/jsdklfjsdklffsf" failed with error "Unknown error"
Rework as discussed
Updating D14913: KCompressionDevice: propagate errors from QIODevice::close()
BUG: 397545
Looks reasonable, given we must live with the constraint of having error() atm only in QFileDevice.