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

Unclear relation between QTemporaryFile::{autoRemove,rename}()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.9.0 Beta1
    • Core: I/O, Documentation
    • None
    • 2

    Description

      The documentation of QTemporaryFile neglects to define the relation between the autoRemove property and the rename() function, specifically whether a rename() will cause autoRemove to be unset or not.

      Given that rename() is akin to QSaveFile::commit(), in that it "finishes" the write by (atomically) overwriting the old file with the new temp file, one could be mistakenly assume that a rename() would cancel autoRemove. It looks as though one has to explicitly disable it, though.

      The relation between the two should be more explicitly documented, perhaps including a QSaveFile-like example:

      • open QTemporaryFile tmp(target), return if failed
      • write to tmp, return if failed
      • tmp.rename(target), return if failed
      • tmp.setAutoRemove(false);

      Attachments

        Issue Links

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

          Activity

            People

              thiago Thiago Macieira
              mmutz Marc Mutz
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes