[Interest] Strange undeletable QTemporaryFile. Is it a bug?

Thiago Macieira thiago.macieira at intel.com
Fri Aug 23 20:34:53 CEST 2013


On sexta-feira, 23 de agosto de 2013 19:53:42, Guido Seifert wrote:
> Hi, Thiago.
> 
> > QTemporaryFile keeps the file open. You can't delete it with
> > QFile::remove, you have to let QTemporaryFile do it. Or, you must destroy
> > the QTemporaryFile object first, so it will actually close the file. Then
> > you can delete it.
> This is strange. Of course I checked with open(). First thing I do when I
> have file problems under Windows. According to this the file was closed. So
> I think this should count as bug then. I would have had far less trouble to
> understand the problem, when open returned 'true'. If what you say is true,
> and I don't doubt it, is there a good reason not fix QTemporaryFile so its
> open() functions always returns true?

open() means it succeeded in opening.

QTemporaryFile::close() truncates and repositions, but doesn't *close* the 
file. If you really want to close, destroy the object or force it to open a new 
file (with a new name).

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- 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/interest/attachments/20130823/81b62834/attachment.sig>


More information about the Interest mailing list