Fix bugs evidenced by change to keep flush errors on QFile::close
commit183be5348e53ef1df9a6e1eb82f10f24ce612f40
authorJoão Abecasis <joao@trolltech.com>
Thu, 7 Jan 2010 14:54:06 +0000 (7 15:54 +0100)
committerJoão Abecasis <joao@trolltech.com>
Thu, 7 Jan 2010 15:33:26 +0000 (7 16:33 +0100)
treebdd08361c176119288bbf0ce9c1c22affb16da1b
parent6bf1674f1e51fd8b08783035cda7493ecd63b443
Fix bugs evidenced by change to keep flush errors on QFile::close

When closing a file, the contents of the write buffer should be emptied
even in the case where flush fails, so it doesn't leak to subsequent
files opened through the same instance. This is inline with what would
happen with native close on a buffered device.

Also changed the resource file engine to succeed on flush. Since all
writes fail there, logically it's write buffer is empty and flush should
succeed. This keeps auto-tests happy :-)

tst_QFile::fullDisk auto-test extended to ensure re-opening QFile does
not keep the write buffer alive.

Reviewed-by: Thiago Macieira
src/corelib/io/qfile.cpp
src/corelib/io/qresource.cpp
tests/auto/qfile/tst_qfile.cpp