mirror of
https://github.com/sogou/workflow.git
synced 2026-02-08 01:33:17 +08:00
Add set_callback for WFModuleTask. Simplify destructor.
This commit is contained in:
@@ -744,6 +744,12 @@ public:
|
||||
public:
|
||||
void *user_data;
|
||||
|
||||
public:
|
||||
void set_callback(std::function<void (const WFModuleTask *)> cb)
|
||||
{
|
||||
this->callback = std::move(cb);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual SubTask *done()
|
||||
{
|
||||
@@ -776,17 +782,8 @@ public:
|
||||
protected:
|
||||
virtual ~WFModuleTask()
|
||||
{
|
||||
SubTask *task = this->first;
|
||||
|
||||
if (task)
|
||||
{
|
||||
this->SeriesWork::callback = nullptr;
|
||||
do
|
||||
{
|
||||
delete task;
|
||||
task = this->pop_task();
|
||||
} while (task);
|
||||
}
|
||||
if (this->first)
|
||||
this->dismiss_recursive();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user