Bug 389290 - [libzip] ZIP compression continues in background even when user cancels it
Summary: [libzip] ZIP compression continues in background even when user cancels it
Status: RESOLVED FIXED
Alias: None
Product: ark
Classification: Applications
Component: plugins (other bugs)
Version First Reported In: 17.12.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Ragnar Thomsen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-21 18:52 UTC by Patrick Silva
Modified: 2018-02-25 22:54 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 18.03.80
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2018-01-21 18:52:18 UTC
open dolphin
right click a folder containing big files
select "Compress > Here (as ZIP)"
some seconds later, a temp file appears in your file system
click notification icon in your system tray, click stop button aside the progress bar
progress bar stops but compression continues in background
If you open ksysgard, you can notice that ark is using your cpu.
Comment 1 Elvis Angelaccio 2018-01-28 14:06:20 UTC
Confirmed, thanks for reporting.
Comment 2 Elvis Angelaccio 2018-02-25 22:54:55 UTC
Git commit b1a251ebb96b86c8cba83343719fa8e67ab4ee9b by Elvis Angelaccio.
Committed on 25/02/2018 at 22:41.
Pushed by elvisangelaccio into branch 'master'.

Rework kill logic

The libzip plugin sometimes cannot react to `QThread::requestInterruption()`
because there is a blocking `zip_close()` which writes to disk (e.g. with AddJobs).

This means we have to manually abort the thread (by passing a timeout to
`QThread::wait()` in `Job::doKill()`. We cannot do this uconditionally
because we would end up with crashes in libarchive. Since the libarchive
plugin is not affected by this problem, we rework the logic in
`Job::doKill()` by assuming that the interface will tell us whether it
needs to be brutally killed. This way we can distinguish between the
libarchive and the libzip plugins (the ones that use a worker thread).

The mutex in this patch is needed because in theory `m_operationMode` could be
read and written by different threads at the same time, even though that's unlikely.
FIXED-IN: 18.03.80
Task: T7824

M  +4    -0    kerfuffle/archiveinterface.h
M  +13   -7    kerfuffle/jobs.cpp
M  +25   -7    plugins/libzipplugin/libzipplugin.cpp
M  +5    -0    plugins/libzipplugin/libzipplugin.h

https://commits.kde.org/ark/b1a251ebb96b86c8cba83343719fa8e67ab4ee9b