Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-13388

There is no possibility to _really_ close QTemporaryFile

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: P2: Important P2: Important
    • None
    • 4.6.3, 4.7.0, 4.7.1, 4.8.0, 4.8.x, 5.0.0, Some future release
    • Core: I/O
    • None

      How to reproduce:
      QTemporary file xxx;
      xxx.open();
      // write something to file
      xxx.close();
      system(QString("move \"%1\" \"%2\"").arg(QDir::toNative(xxx.fileName()), "newname"));

      last directive will fail!
      because file handle is still open! Windows does not allow to do some operation on files which are still open.

      Yes, documentation said that "It is safe to reopen....."', but it does not say about not closing file handle. I thought, that open is 'safe' because file name is unique.

      Please add option to really close() temporary file, or fix documentation. I prefer first choice.

      Even after real close(), file should be tried to remove in destructor according to autoRemove property

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            biochimia João Abecasis
            socketpair@gmail.com Коренберг Марк
            Votes:
            2 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes