[Development] QFile: writing via a temporary file

Thiago Macieira thiago.macieira at intel.com
Fri Jan 6 22:13:00 CET 2012


On Friday, 6 de January de 2012 21.27.20, David Faure wrote:
> Exception handling is a new argument though. But doesn't the current QFile 
> have the exact same issue then? You start writing, throw an exception, dtor 
> calls close, there you go. The use of an internal temporary file doesn't
> change this at all, so I don't see why it should behave differently.

The file will be closed no matter what, unless you allow for the file descriptor 
to leak. And even if it were to leak, the writing was already done and has 
appeared on disk.

That's very different from executing a rename upon closure. Up until that 
point, any observers of the file have not seen any change. Then they do and see 
an in-progress change being saved.

No, whatever this class is, close() without commit() means "rollback".

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120106/c22ce2b3/attachment.sig>


More information about the Development mailing list