mirror of
https://github.com/PrismLauncher/PrismLauncher
synced 2026-04-23 09:05:03 +00:00
Add asserts to invalid Task states
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
(cherry picked from commit 9ac0314d7a)
This commit is contained in:
parent
3e567fef3b
commit
f686d9b598
|
|
@ -98,6 +98,7 @@ void Task::start()
|
|||
case State::Running: {
|
||||
if (m_show_debug)
|
||||
qCWarning(taskLogC) << "The launcher tried to start task" << describe() << "while it was already running!";
|
||||
Q_ASSERT(!isRunning());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -112,6 +113,7 @@ void Task::emitFailed(QString reason)
|
|||
// Don't fail twice.
|
||||
if (!isRunning()) {
|
||||
qCCritical(taskLogC) << "Task" << describe() << "failed while not running!!!!: " << reason;
|
||||
Q_ASSERT(!isRunning());
|
||||
return;
|
||||
}
|
||||
m_state = State::Failed;
|
||||
|
|
@ -126,6 +128,7 @@ void Task::emitAborted()
|
|||
// Don't abort twice.
|
||||
if (!isRunning()) {
|
||||
qCCritical(taskLogC) << "Task" << describe() << "aborted while not running!!!!";
|
||||
Q_ASSERT(!isRunning());
|
||||
return;
|
||||
}
|
||||
m_state = State::AbortedByUser;
|
||||
|
|
@ -141,6 +144,7 @@ void Task::emitSucceeded()
|
|||
// Don't succeed twice.
|
||||
if (!isRunning()) {
|
||||
qCCritical(taskLogC) << "Task" << describe() << "succeeded while not running!!!!";
|
||||
Q_ASSERT(!isRunning());
|
||||
return;
|
||||
}
|
||||
m_state = State::Succeeded;
|
||||
|
|
|
|||
Loading…
Reference in a new issue