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

QTemporaryFile - location changed after remove() used

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.5.1
    • 5.4.1
    • Core: Other
    • None
    • 02418d1aaa6760e08d55f0f6213d02d56b057fd2

    Description

      Location of temporary file changes from real temp directory to executable directory, when remove function is used.

      #include <QCoreApplication>
      #include <QTemporaryFile>
      #include <QDebug>
      
      int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);
      
          QTemporaryFile tmpFile;
      
          if (tmpFile.open())
              qDebug() << tmpFile.fileName();
      
          tmpFile.remove();
      
          if (tmpFile.open())
              qDebug() << tmpFile.fileName();
      
          //return a.exec();
          return 0;
      }
      

      This is result:

      "C:/Users/theuerom/AppData/Local/Temp/tmpfiletest.Hp3912"
      "C:/Qt5_projects/build-tmpfiletest-Desktop_Qt_5_4_1_MinGW_32bit-Debug/.gq3912"
      

      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
              rth Roman Theuer
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes