TaskTree: Fix some coverity scan issues (use std::move)

Coverity-Id: 462757 462760 462768 480367
Change-Id: I56c17ba925459661f425ef72eeb1d397094e5a90
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit f148cc38277f260a1be3b4838c234a2c6fefe765)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Jarek Kobus 2025-05-15 17:35:51 +02:00 committed by Qt Cherry-pick Bot
parent 33cf9c3f95
commit fb59d0eb75

View File

@ -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<Adapter &>(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<const Adapter &>(taskInterface);