diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2023-12-13 12:03:03 -0300 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2023-12-14 19:49:47 +0000 |
commit | a337b8360f149313f5bf37dc5867413d846a3a97 (patch) | |
tree | c07bb01110641e99c92d73608bc6a3f1160a0f7a /src/corelib/kernel | |
parent | c90ee82789139a4001fcc10f3fa958f70087cb26 (diff) |
Suppress clang-tidy mem leak warning on QMetaObject::invokeMethod
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.7 6.6 6.5
Change-Id: I6e2677aad2ab45759db2fffd17a06c57c3a463ba
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qobjectdefs.h | 1 | ||||
-rw-r--r-- | src/corelib/kernel/qobjectdefs_impl.h | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index 1ff4ee80b6..7763cea6ef 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -622,6 +622,7 @@ private: auto h = QtPrivate::invokeMethodHelper(ret, args...); + // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks) auto callable = new QtPrivate::QCallableObject<std::decay_t<Func>, ActualArguments, typename Callable::ReturnType>(std::forward<Func>(function)); return invokeMethodImpl(object, callable, type, h.parameterCount(), h.parameters.data(), diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h index d45971fc87..ec9f12f5f1 100644 --- a/src/corelib/kernel/qobjectdefs_impl.h +++ b/src/corelib/kernel/qobjectdefs_impl.h @@ -622,6 +622,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<std::decay_t<Functor>, ActualArguments, ExpectedReturnType>(std::forward<Functor>(func)); } |