Task: Warn when disposing while running (#5371)

This commit is contained in:
Alexandru Ionut Tripon 2026-04-14 16:27:24 +00:00 committed by GitHub
commit a0c5893a98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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;