Skip to content

Commit 2421bab

Browse files
authored
Fix WFTaskFactory::release_guard_safe() bug. (sogou#1769)
1 parent d865bd9 commit 2421bab

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

src/factory/WFTaskFactory.cc

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -986,10 +986,6 @@ class __WFNamedGuard : public WFConditional
986986
__guard_map.unref(guards_);
987987
}
988988

989-
SubTask *get_task() const { return this->task; }
990-
991-
void set_task(SubTask *task) { this->task = task; }
992-
993989
protected:
994990
virtual void dispatch();
995991
virtual void signal(void *msg) { }
@@ -1100,12 +1096,11 @@ int WFTaskFactory::release_guard_safe(const std::string& name, void *msg)
11001096
if (!node)
11011097
return 0;
11021098

1103-
timer = WFTaskFactory::create_timer_task(0, 0, [](WFTimerTask *timer) {
1104-
series_of(timer)->push_front((SubTask *)timer->user_data);
1099+
timer = WFTaskFactory::create_timer_task(0, 0, [node](WFTimerTask *timer) {
1100+
node->guard->WFConditional::signal(timer->user_data);
11051101
});
1106-
timer->user_data = node->guard->get_task();
1107-
node->guard->set_task(timer);
1108-
node->guard->WFConditional::signal(msg);
1102+
timer->user_data = msg;
1103+
timer->start();
11091104
return 1;
11101105
}
11111106

0 commit comments

Comments
 (0)