https://bugs.kde.org/show_bug.cgi?id=520362

Dmitry Kazakov <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Latest Commit|https://invent.kde.org/grap |https://invent.kde.org/grap
                   |hics/krita/-/commit/b248bcb |hics/krita/-/commit/9c19c13
                   |47358353d9e00a403d0459955e6 |5ad3987ba6803acb866bb1505d2
                   |9ec505                      |285e36

--- Comment #6 from Dmitry Kazakov <[email protected]> ---
Git commit 9c19c135ad3987ba6803acb866bb1505d2285e36 by Dmitry Kazakov, on
behalf of Agata Cacko.
Committed on 11/06/2026 at 09:13.
Pushed by dkazakov into branch 'krita/6.0'.

Delete QuaZipFile before deleting the archive

Before this commit, Krita would crash in two situations:
1) on creating welcome page, when the recent file list contained
a corrupted zip file (from which you cannot read a png file
for the preview)
2) on File -> Open, if you click on such corrupted file to see the
   preview.
It would happen in the destructor of KoQuaZipStore.
This was caused by several layers of abstractions between Krita and the
zip file, especially the confusion in KoQuaZipStore.
This commit fixes it by reversing the order KoQuaZipStore deletes its
pointers: it should be first deleting the file, and then the archive.

If the dd->currentFile is corrupt (and ->getZipError() returns an error code)
QuaZip cannot really close it properly (and I don't see an accessible function
to reset the error code).
Therefore the destructor thinks the file is open and tries to close it.
And closing the file means checking if the zip archive associated with the file
is open or not.
Therefore the archive must exist when the file is being closed, therefore also
when it's being deleted.
In comparison, the archive can be deleted whenever and it doesn't check the
current file.
Therefore we gotta delete the file first, then the zip archive.

>From QuaZip code comments for `QuaZipFile(QuaZip *zip, QObject *parent
=nullptr);`:
"* Summary: do not close \c zip object or change its current file as
 * long as QuaZipFile is open."

M  +15   -1    libs/store/KoQuaZipStore.cpp

https://invent.kde.org/graphics/krita/-/commit/9c19c135ad3987ba6803acb866bb1505d2285e36

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to