From f2f5c7d2b71a93ff826e3731cbb80febe5c7b308 Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Fri, 28 Jan 2022 14:31:46 +0100 Subject: QtFuture::connect: fix for signals with a single std::tuple argument If the signal passed to QtFuture::connect() takes multiple arguments, we need to wrap the arguments in a std::tuple when reporting the result. To detect this case we were checking if the result type of a QFuture returned by QtFuture::connect() is a std::tuple, but this was not correct: the result type could be a std::tuple also if the passed signal takes a single std::tuple argument. Instead, check if the signal takes more than one argument. As a drive-by modified the tst_QFuture::signalConnect to use const values for tuples used in multiple test-cases, to avoid repetition. Fixes: QTBUG-100071 Pick-to: 6.2 6.3 Change-Id: I1ce39cf87028f36ef94a9d1a4423b0c51473afd4 Reviewed-by: Marc Mutz Reviewed-by: Edward Welbourne --- src/corelib/thread/qfuture_impl.h | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'src/corelib/thread/qfuture_impl.h') diff --git a/src/corelib/thread/qfuture_impl.h b/src/corelib/thread/qfuture_impl.h index 2924408333..22f51d755b 100644 --- a/src/corelib/thread/qfuture_impl.h +++ b/src/corelib/thread/qfuture_impl.h @@ -279,17 +279,6 @@ template using EnableIfInvocable = std::enable_if_t< QtPrivate::ArgResolver::template CanInvokeWithArgs>; -template -struct isTuple : std::false_type -{ -}; -template -struct isTuple> : std::true_type -{ -}; -template -inline constexpr bool isTupleV = isTuple::value; - template inline constexpr bool isQFutureV = false; @@ -902,7 +891,7 @@ static QFuture> connect(Sender *sender, Signal signal) QObject::disconnect(connections->second); promise.reportFinished(); }); - } else if constexpr (QtPrivate::isTupleV) { + } else if constexpr (QtPrivate::ArgResolver::HasExtraArgs) { connections->first = QObject::connect(sender, signal, sender, [promise, connections](auto... values) mutable { QObject::disconnect(connections->first); -- cgit v1.2.3