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

PdfDocument QML object does not unload PDF file

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • 6.5.5, 6.6.3
    • 6.5.2, 6.5.3
    • PDF
    • None
    • Window 10, MSVC
    • Windows

    Description

      Please note: Qt PDF in 6.5.x is only available for MSVC build

      The application that is able to reproduce the bug is attached. The application works as follows:

      • CMake run copies 2 PDF files to build folder (which is application execution folder):
        testfile.pdf
        otherfile.pdf
      • When application is launched, it starts 15 second timer.
      • When the 15 second timer runs out, application will delete testfile.pdf
      • On screen, a label will be updated telling if delete was successful (returned true) or not (returned false).

      Here are the different scenarios, including the ones with the bug visible:

      1. Let the application run without doing anything.
        -> File is deleted after 15 seconds, correct.
      2. When application has started, click on the "Open and switch file after 1 sec" button within first 14 seconds.
        (PdfDocument loads testfile.pdf and after 1 second, switches source to otherfile.pdf. At 15 second time file is tried to be deleted.)
        -> File is deleted, correct.
      3. When application has started, click on the "Open viewer for 10 seconds" button after first 5 seconds.
        (PdfDocument loads testfile.pdf and before PdfDocument object is destroyed, file is tried to be deleted)
        -> File is not deleted as it is open in viewer, correct.
      4. When application has started, click on the "Open viewer for 10 seconds" button before first 5 seconds have passed.
        (PdfDocument loads testfile.pdf and after 10 seconds the PdfDocument object is destroyed. After this the file is tried to be deleted)
        -> File is not deleted because PdfDocument still keeps it locked, error.
      5. When application has started, click on the "Open and switch to empty URL after 1 sec" button before first 5 seconds have passed.
        (PdfDocument loads testfile.pdf and after 1 second, switches source to empty URL. The entire PdfDocument is unloaded after 9 more seconds and after this the file is tried to be deleted.)
        -> File is not deleted because PdfDocument still keeps it locked, error.

      Please note that when PDF is removed from the UI, the entire QML file that contains the PdfDocument is unloaded. The file from file system should not be possible to be open anymore after that, but it is.

      Attachments

        Issue Links

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

          Activity

            People

              srutledg Shawn Rutledge
              ottoryynanen Otto Ryynänen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes