diff options
| author | Thiago Macieira <thiago.macieira@intel.com> | 2024-12-18 12:31:53 -0300 |
|---|---|---|
| committer | Thiago Macieira <thiago.macieira@intel.com> | 2024-12-26 12:53:13 -0300 |
| commit | 92373d353cf090faa03cbc8aca505d1784b10b54 (patch) | |
| tree | aea0cf6a7839692e8347d832ef11ea57cfa0867a /src/tools/uic/cpp/cppwriteinitialization.cpp | |
| parent | b884fbf10237547e809745f528978942faf0e5f6 (diff) | |
QSaveFile: make it so flush() errors imply commit() failed
QSaveFile records past write errors in writeData(), but often the
QFileDevice::writeData() calls it places will succeed because the data
is only being buffered. Instead, the failures are noticed only by
flush(), whose actions do not affect QSaveFilePrivate::writeError.
[ChangeLog][QtCore][QSaveFile] Fixed a bug that caused commit() to
return true and overwrite its intended target file even though it failed
to flush buffered data to the storage, which could cause data loss. This
issue can be worked around by calling flush() first and only calling
commit() if that returns success.
[ChangeLog][QtCore][QSaveFile] Fixed a bug that caused commit() to
return true even after a cancelWriting() call had been placed, if
writing directly to the target file (that is, only with
setDirectWriteFallback() set to true). Note that the state of the file
does not change under those conditions, only the value returned by the
function.
Drive-by clarify a comment from 6bf1674f1e51fd8b08783035cda7493ecd63b44
(Qt 4.6 "Don't drop errors from flush on QFile::close") which had me
chasing the wrong lead.
Fixes: QTBUG-132332
Pick-to: 6.9 6.8 6.5 5.15
Change-Id: I427df6fd02132d02be91fffd175579c35b9c06cc
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src/tools/uic/cpp/cppwriteinitialization.cpp')
0 files changed, 0 insertions, 0 deletions
