From fb59d0eb75d49d2ef4b8a327a153d07d6a256a9f Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 15 May 2025 17:35:51 +0200 Subject: [PATCH] TaskTree: Fix some coverity scan issues (use std::move) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Coverity-Id: 462757 462760 462768 480367 Change-Id: I56c17ba925459661f425ef72eeb1d397094e5a90 Reviewed-by: Kai Köhne (cherry picked from commit f148cc38277f260a1be3b4838c234a2c6fefe765) Reviewed-by: Qt Cherry-pick Bot --- src/assets/downloader/tasking/tasktree.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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);