mirror of https://github.com/PentHertz/srsLTE.git
pass task functor by copy to avoid dangling pointers
This commit is contained in:
parent
b2d3c2a150
commit
6746c5dfa5
|
@ -240,10 +240,10 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
template <typename Func>
|
template <typename Func>
|
||||||
moveable_task_t(Func&& f, Capture&& c) :
|
moveable_task_t(Func&& f, Capture&& c) : capture(std::forward<Capture>(c))
|
||||||
func([this, f]() { f(std::move(capture)); }),
|
|
||||||
capture(std::forward<Capture>(c))
|
|
||||||
{
|
{
|
||||||
|
std::function<void(Capture)> ftmp{std::forward<Func>(f)};
|
||||||
|
func = [this, ftmp]() { ftmp(std::move(capture)); };
|
||||||
}
|
}
|
||||||
void operator()() { func(); }
|
void operator()() { func(); }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue