Details
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:
- Let the application run without doing anything.
-> File is deleted after 15 seconds, correct. - 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. - 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. - 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. - 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
- duplicates
-
QTBUG-123893 QPdfDocument::close leaks a handle to the loaded file
-
- Reported
-