karchivemanager: interrupt thread and wait for it to finish from KArchiveModel destructor

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-17 14:30:31 +03:00
parent bc53a4961f
commit 04caf1c1ff

View file

@ -84,7 +84,8 @@ protected:
KArchiveModelPrivate::KArchiveModelPrivate(QObject *parent)
: QThread(parent),
m_interrupt(false) {
m_interrupt(false)
{
}
// because altering paths is not easy
@ -182,7 +183,7 @@ void KArchiveModelPrivate::run()
m_interrupt = false;
foreach (const KArchiveEntry &info, m_list) {
if(m_interrupt) {
if (m_interrupt) {
return;
}
@ -207,9 +208,11 @@ KArchiveModel::KArchiveModel(QObject *parent)
KArchiveModel::~KArchiveModel()
{
if (d) {
delete d;
if (d->isRunning()) {
d->requestInterruption();
d->wait();
}
delete d;
}
bool KArchiveModel::loadArchive(const KArchive *archive)