[Interest] Strange undeletable QTemporaryFile. Is it a bug?
cmakshin at gmail.com
Sat Aug 24 09:46:22 CEST 2013
Overriding a public method to make it private doesn't make much sense
because this restriction can be easily circumvented by casting the
pointer/reference to a base class (explicitly or by passing it to a
function, in the context of this thread, expects a QFile or even more
On Aug 24, 2013 2:16 AM, "Alex Malyushytskyy" <alexmalvtk at gmail.com> wrote:
> >> 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.
> I disagree, then You would have
> QTemporaryFile attached to file which is not anymore
> under control.
> This would be even more confusing and made documented features wrong:
> "the file will subsequently be removed upon destruction of the
> QTemporaryFile object."
> "Detaching" could be made in close(), but in this case you leave useless
> now QTemporaryFile alive.
> I think current implementation is less alone prone.
> What can be done - I would override close just to make it private, so
> people do not call it.
> On Fri, Aug 23, 2013 at 11:50 AM, Guido Seifert <wargand at gmx.de> wrote:
>> > open() means it succeeded in opening.
>> > QTemporaryFile::close() truncates and repositions, but doesn't *close*
>> > 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.
>> Interest mailing list
>> Interest at qt-project.org
> Interest mailing list
> Interest at qt-project.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Interest