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

QImageReader will lock the file after calling canRead

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 5.6.2, 5.9.0 RC
    • Image formats
    • None
    • Qt5.6.2 msvc2015 32bits

      Qt5.9RC1 msvc2015 64bits

      windows 10 64bits

    Description

      Calling api canRead will block the file on windows 10 64bits. I attach a small project to reproduce the bug.

       

      Things to noticed :

      1 : copy img_links.txt to your shadow build folder

      shadow_build
      --debug
      --release
      --img_links.txt

      2 : Create a folder "img" in shadow build folder

      shadow_build
      --debug
      --release
      --img

       

      For more info, please go to https://forum.qt.io/topic/79789/cannot-rename-by-qfile-rename/9

       

       

      static size_t num = 0;
      QImageReader reader(name);
      reader.setDecideFormatFromContent(true);
      reader.canRead(); //after calling can read, the file will be locked
      bool const can_rename = QFile::rename(name, QString("img/sos%1").arg(num++));
      qDebug()<<"can rename:"<<can_rename;
      

       

      Attachments

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

        Activity

          People

            vgt Eirik Aavitsland
            tham tham
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes