Quit LibArchiveInterface::list() and the associated ListJob before deleting LibArchiveInterface in Archive's destructor

Review Request #105404 - Created July 1, 2012 and discarded

Information
Nathan Mills
ark
master
193908
Reviewers
kdeutils
rkcosta
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.
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.
Nathan Mills
Elvis Angelaccio
Nathan Mills
Review request changed

Status: Discarded

Loading...