Properly handle Task Deletion #703

This commit is contained in:
Florian Märkl 2018-11-11 10:40:42 +01:00
parent 54ea5f014e
commit a3188ed028
2 changed files with 5 additions and 5 deletions

View File

@ -1,20 +1,20 @@
#include "R2Task.h"
R2Task::R2Task(const QString &cmd)
R2Task::R2Task(const QString &cmd, bool transient)
{
task = r_core_task_new(Core()->core(),
true,
cmd.toLocal8Bit().constData(),
static_cast<RCoreTaskCallback>(&R2Task::taskFinishedCallback),
this);
task->transient = transient;
r_core_task_incref(task);
}
R2Task::~R2Task()
{
// Don't delete current task as it might be still running
// TODO
// For now tasks are not freed, so find we need to something
r_core_task_decref(task);
}
void R2Task::taskFinishedCallback(void *user, char *)

View File

@ -15,7 +15,7 @@ private:
void taskFinished();
public:
explicit R2Task(const QString &cmd);
explicit R2Task(const QString &cmd, bool transient = true);
~R2Task();
void startTask();