mirror of
https://bitbucket.org/smil3y/kde-playground.git
synced 2025-02-23 18:32:51 +00:00
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:
parent
bc53a4961f
commit
04caf1c1ff
1 changed files with 7 additions and 4 deletions
|
@ -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
|
||||||
|
@ -182,7 +183,7 @@ void KArchiveModelPrivate::run()
|
||||||
m_interrupt = false;
|
m_interrupt = false;
|
||||||
|
|
||||||
foreach (const KArchiveEntry &info, m_list) {
|
foreach (const KArchiveEntry &info, m_list) {
|
||||||
if(m_interrupt) {
|
if (m_interrupt) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
|
Loading…
Add table
Reference in a new issue