Review Request: Quit LibArchiveInterface::list() and the associated ListJob before deleting LibArchiveInterface in Archive's destructor
Nathan Mills
nn.dm55 at gmail.com
Fri Oct 26 17:53:11 UTC 2012
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/105404/
-----------------------------------------------------------
(Updated Oct. 26, 2012, 5:53 p.m.)
Review request for KDE Utils and Raphael Kubo da Costa.
Changes
-------
If LibArchiveInterface::doKill() is called before list() sets m_listing, the check for whether list() is running in Archive's destructor will succeed, causing LibArchiveInterface to be deleted. Protect against this by returning from list() immediately if this ever happens.
Description
-------
This patch fixes the crash when initially opening an archive with Ark using libarchive. The patch prevents a Job from using a deleted LibArchiveInterface by making sure that the Job quits before the LibArchiveInterface is deleted.
When an Archive instance is being destroyed, the destructor first asks its ReadOnlyArchiveInterface instance to quit. The instance, which is really a LibArchiveInterface, then waits for its list() method to quit. Then the Archive instance's destructor waits for the most recently started Job to quit. Archive's destructor only waits for the Job to quit if the Archive's ReadOnlyArchiveInterface supports doKill().
This patch could easily be extended to other Jobs as follows: For DeleteJob, the interface's doKill() method needs to quit the deleteFiles() call cleanly. For ExtractJob, the interface's doKill() method needs to quit copyFiles() cleanly. For AddJob, the interface's doKill() method needs to quit the addFiles() method cleanly. These three jobs should probably ask the user whether to continue with the operation, halt the operation, or delete the added/copied files.
This addresses bug 193908.
http://bugs.kde.org/show_bug.cgi?id=193908
Diffs (updated)
-----
kerfuffle/archive.h 515788f
kerfuffle/archive.cpp c2c5b18
kerfuffle/jobs.h d704dfc
kerfuffle/jobs.cpp aedc62c
plugins/libarchive/libarchivehandler.h 9ec7541
plugins/libarchive/libarchivehandler.cpp cd473ee
Diff: http://git.reviewboard.kde.org/r/105404/diff/
Testing
-------
I started the patched version of Ark with a large tar archive and a small tar archive pressing Ctrl+Q each time. Then I reverted the patch, compiled Ark, and compared how long the unpatched version took to quit to make sure the patch didn't cause excessively long waits.
Thanks,
Nathan Mills
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-utils-devel/attachments/20121026/9b68cc88/attachment.html>
More information about the Kde-utils-devel
mailing list