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) KArchiveModelPrivate::KArchiveModelPrivate(QObject *parent)
: QThread(parent), : QThread(parent),
m_interrupt(false) { m_interrupt(false)
{
} }
// because altering paths is not easy // because altering paths is not easy
@ -207,9 +208,11 @@ KArchiveModel::KArchiveModel(QObject *parent)
KArchiveModel::~KArchiveModel() KArchiveModel::~KArchiveModel()
{ {
if (d) { if (d->isRunning()) {
delete d; d->requestInterruption();
d->wait();
} }
delete d;
} }
bool KArchiveModel::loadArchive(const KArchive *archive) bool KArchiveModel::loadArchive(const KArchive *archive)