From f686d9b598f5e7935d602b58ff735e37774fde9c Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Wed, 21 Jan 2026 17:10:14 +0500 Subject: [PATCH] Add asserts to invalid Task states Signed-off-by: Octol1ttle (cherry picked from commit 9ac0314d7ac39bdf93e5d80bf054ffce4434fe3e) --- launcher/tasks/Task.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/launcher/tasks/Task.cpp b/launcher/tasks/Task.cpp index 92b345c8d..d59660146 100644 --- a/launcher/tasks/Task.cpp +++ b/launcher/tasks/Task.cpp @@ -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;