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

QTemporaryFile - location changed after remove() used

XMLWordPrintable

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

      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"
      

        For Gerrit Dashboard: QTBUG-46156
        # Subject Branch Project Status CR V

            thiago Thiago Macieira
            rth Roman Theuer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes