diff --git a/src/assets/downloader/tasking/tasktree.h b/src/assets/downloader/tasking/tasktree.h index 731dffaffc4..d46bd8eee3e 100644 --- a/src/assets/downloader/tasking/tasktree.h +++ b/src/assets/downloader/tasking/tasktree.h @@ -370,7 +370,7 @@ private: static_assert(isR || isV, "Group setup handler needs to take no arguments and has to return void or SetupResult. " "The passed handler doesn't fulfill these requirements."); - return [handler] { + return [handler = std::move(handler)] { if constexpr (isR) return std::invoke(handler); std::invoke(handler); @@ -392,7 +392,7 @@ private: "Group done handler needs to take (DoneWith) or (void) as an argument and has to " "return void, bool or DoneResult. Alternatively, it may be of DoneResult type. " "The passed handler doesn't fulfill these requirements."); - return [handler](DoneWith result) { + return [handler = std::move(handler)](DoneWith result) { if constexpr (isDoneResultType) return handler; if constexpr (isRD) @@ -576,7 +576,7 @@ private: static_assert(isR || isV, "Task setup handler needs to take (Task &) as an argument and has to return void or " "SetupResult. The passed handler doesn't fulfill these requirements."); - return [handler](TaskInterface &taskInterface) { + return [handler = std::move(handler)](TaskInterface &taskInterface) { Adapter &adapter = static_cast(taskInterface); if constexpr (isR) return std::invoke(handler, *adapter.task()); @@ -610,7 +610,7 @@ private: "(DoneWith) or (void) as arguments and has to return void, bool or DoneResult. " "Alternatively, it may be of DoneResult type. " "The passed handler doesn't fulfill these requirements."); - return [handler](const TaskInterface &taskInterface, DoneWith result) { + return [handler = std::move(handler)](const TaskInterface &taskInterface, DoneWith result) { if constexpr (isDoneResultType) return handler; const Adapter &adapter = static_cast(taskInterface);