diff --git a/include/sled/task_queue/pending_task_safety_flag.h b/include/sled/task_queue/pending_task_safety_flag.h index e1d5e4e..f1c1170 100644 --- a/include/sled/task_queue/pending_task_safety_flag.h +++ b/include/sled/task_queue/pending_task_safety_flag.h @@ -54,7 +54,7 @@ private: inline std::function SafeTask(scoped_refptr flag, std::function task) { - return [task, flag]() mutable { + return [flag, task]() mutable { if (flag->alive()) { std::move(task)(); } }; } diff --git a/src/timer/task_queue_timeout.cc b/src/timer/task_queue_timeout.cc index 3ef1eb2..2599232 100644 --- a/src/timer/task_queue_timeout.cc +++ b/src/timer/task_queue_timeout.cc @@ -7,7 +7,8 @@ namespace sled { TaskQueueTimeoutFactory::TaskQueueTimeout::TaskQueueTimeout(TaskQueueTimeoutFactory &parent, sled::TaskQueueBase::DelayPrecision precision) : parent_(parent), - precision_(precision) + precision_(precision), + safety_flag_(PendingTaskSafetyFlag::Create()) {} TaskQueueTimeoutFactory::TaskQueueTimeout::~TaskQueueTimeout() {}