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

View File

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