From 6c43c86f6b9621552907174e6c58b4a8c2d27219 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 13 Dec 2023 12:03:03 -0300 Subject: [PATCH] Suppress clang-tidy mem leak warning on QMetaObject::invokeMethod MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don't leak, but clang-tidy is printing this warning. Possibly because it sees a new with no matched delete in the same context, ignoring the fact that the pointer was gifted to the called function. Fixes: QTBUG-119972 Pick-to: 6.5 Change-Id: I6e2677aad2ab45759db2fffd17a06c57c3a463ba Reviewed-by: Marc Mutz Reviewed-by: MÃ¥rten Nordheim (cherry picked from commit a337b8360f149313f5bf37dc5867413d846a3a97) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit b0c031b51b870fc52701f0c445718375a682cb84) --- src/corelib/kernel/qobjectdefs_impl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h index a45792c5d7f..d903de43587 100644 --- a/src/corelib/kernel/qobjectdefs_impl.h +++ b/src/corelib/kernel/qobjectdefs_impl.h @@ -589,6 +589,7 @@ namespace QtPrivate { static_assert(int(ActualSignature::ArgumentCount) <= int(ExpectedSignature::ArgumentCount), "Functor requires more arguments than what can be provided."); + // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks) return new QtPrivate::QCallableObject, ActualArguments, ExpectedReturnType>(std::forward(func)); }