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

Guido Seifert wargand at gmx.de
Fri Aug 23 20:50:34 CEST 2013


> 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).

Bah, stupid me. Wrong function. I meant of course 'isOpen()', sorry. Am I so wrong that I expect a 'true' when the file is still open? 

But, erm... yes... now that you say it, I can even find this behaviour in the docs:

Reopening a QTemporaryFile after calling close() is safe. For as long as the QTemporaryFile object itself is not destroyed, the unique temporary file will exist and be kept open internally by QTemporaryFile.

I can't say that I am very happy with a non-closing close() and a lying isOpen(). Even if documented, it goes against any expectations.

Guido



More information about the Interest mailing list