From 6746c5dfa5189a937ea724759efc5643b6368a67 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Fri, 22 Nov 2019 15:29:03 +0000 Subject: [PATCH] pass task functor by copy to avoid dangling pointers --- lib/include/srslte/common/multiqueue.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/include/srslte/common/multiqueue.h b/lib/include/srslte/common/multiqueue.h index 83cfbe998..560270efb 100644 --- a/lib/include/srslte/common/multiqueue.h +++ b/lib/include/srslte/common/multiqueue.h @@ -240,10 +240,10 @@ public: { } template - moveable_task_t(Func&& f, Capture&& c) : - func([this, f]() { f(std::move(capture)); }), - capture(std::forward(c)) + moveable_task_t(Func&& f, Capture&& c) : capture(std::forward(c)) { + std::function ftmp{std::forward(f)}; + func = [this, ftmp]() { ftmp(std::move(capture)); }; } void operator()() { func(); }