mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
Add asserts to invalid Task states
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
ef747055af
commit
9ac0314d7a
1 changed files with 4 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue