made sure abort signal is catched in cocurent task

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-07-15 09:16:37 +03:00
parent b54e093313
commit 0880d4d37b
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318

View File

@ -88,6 +88,7 @@ bool ConcurrentTask::abort()
QMutableHashIterator<Task*, Task::Ptr> doing_iter(m_doing); QMutableHashIterator<Task*, Task::Ptr> doing_iter(m_doing);
while (doing_iter.hasNext()) { while (doing_iter.hasNext()) {
auto task = doing_iter.next(); auto task = doing_iter.next();
disconnect(task.value().get(), &Task::aborted, this, 0);
suceedeed &= (task.value())->abort(); suceedeed &= (task.value())->abort();
} }
@ -133,6 +134,9 @@ void ConcurrentTask::startNext()
connect(next.get(), &Task::succeeded, this, [this, next]() { subTaskSucceeded(next); }); connect(next.get(), &Task::succeeded, this, [this, next]() { subTaskSucceeded(next); });
connect(next.get(), &Task::failed, this, [this, next](QString msg) { subTaskFailed(next, msg); }); connect(next.get(), &Task::failed, this, [this, next](QString msg) { subTaskFailed(next, msg); });
// this should never happen but if it does better to fail the task that being stuck
// most
connect(next.get(), &Task::aborted, this, [this, next] { subTaskFailed(next, "Aborted"); });
connect(next.get(), &Task::status, this, [this, next](QString msg) { subTaskStatus(next, msg); }); connect(next.get(), &Task::status, this, [this, next](QString msg) { subTaskStatus(next, msg); });
connect(next.get(), &Task::details, this, [this, next](QString msg) { subTaskDetails(next, msg); }); connect(next.get(), &Task::details, this, [this, next](QString msg) { subTaskDetails(next, msg); });