change(Task): warn when disposing while running

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2026-04-12 13:48:15 +05:00
parent a17a45c748
commit ae7e143537
No known key found for this signature in database
GPG key ID: B77C34313AEE1FFF
2 changed files with 8 additions and 1 deletions

View file

@ -48,6 +48,13 @@ Task::Task(bool show_debug) : m_show_debug(show_debug)
setAutoDelete(false);
}
Task::~Task()
{
if (isRunning()) {
qCWarning(taskLogC) << "Task" << describe() << "disposed while running!";
}
}
void Task::setStatus(const QString& new_status)
{
if (m_status != new_status) {

View file

@ -94,7 +94,7 @@ class Task : public QObject, public QRunnable {
public:
explicit Task(bool show_debug_log = true);
virtual ~Task() = default;
~Task() override;
bool isRunning() const;
bool isFinished() const;