mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
Fixes for task abort logic (#5415)
This commit is contained in:
commit
49e9f96327
3 changed files with 9 additions and 4 deletions
|
|
@ -18,7 +18,7 @@ bool InstanceCreationTask::abort()
|
||||||
return m_gameFilesTask->abort();
|
return m_gameFilesTask->abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return InstanceTask::abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstanceCreationTask::executeTask()
|
void InstanceCreationTask::executeTask()
|
||||||
|
|
|
||||||
|
|
@ -100,13 +100,18 @@ auto NetJob::canAbort() const -> bool
|
||||||
|
|
||||||
auto NetJob::abort() -> bool
|
auto NetJob::abort() -> bool
|
||||||
{
|
{
|
||||||
bool fullyAborted = true;
|
|
||||||
|
|
||||||
// fail all downloads on the queue
|
// fail all downloads on the queue
|
||||||
for (auto task : m_queue)
|
for (auto task : m_queue)
|
||||||
m_failed.insert(task.get(), task);
|
m_failed.insert(task.get(), task);
|
||||||
m_queue.clear();
|
m_queue.clear();
|
||||||
|
|
||||||
|
if (m_doing.isEmpty()) {
|
||||||
|
// no downloads to abort, NetJob is not running
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool fullyAborted = true;
|
||||||
|
|
||||||
// abort active downloads
|
// abort active downloads
|
||||||
auto toKill = m_doing.values();
|
auto toKill = m_doing.values();
|
||||||
for (auto part : toKill) {
|
for (auto part : toKill) {
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ class Task : public QObject, public QRunnable {
|
||||||
//! used by external code to ask the task to abort
|
//! used by external code to ask the task to abort
|
||||||
virtual bool abort()
|
virtual bool abort()
|
||||||
{
|
{
|
||||||
if (canAbort())
|
if (canAbort() && isRunning())
|
||||||
emitAborted();
|
emitAborted();
|
||||||
return canAbort();
|
return canAbort();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue