summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qfuture_impl.h
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2022-01-28 14:31:46 +0100
committerSona Kurazyan <sona.kurazyan@qt.io>2022-01-31 17:40:43 +0100
commitf2f5c7d2b71a93ff826e3731cbb80febe5c7b308 (patch)
tree9559987fb6d84c118715ce87ac11b22d9d622064 /src/corelib/thread/qfuture_impl.h
parent26fa539ad21ebe6366975ac613ea83451d0bf5da (diff)
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 <marc.mutz@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/thread/qfuture_impl.h')
-rw-r--r--src/corelib/thread/qfuture_impl.h13
1 files changed, 1 insertions, 12 deletions
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<class Class, class Callable>
using EnableIfInvocable = std::enable_if_t<
QtPrivate::ArgResolver<Callable>::template CanInvokeWithArgs<Class, Callable>>;
-template<class>
-struct isTuple : std::false_type
-{
-};
-template<class... T>
-struct isTuple<std::tuple<T...>> : std::true_type
-{
-};
-template<class T>
-inline constexpr bool isTupleV = isTuple<T>::value;
-
template<class T>
inline constexpr bool isQFutureV = false;
@@ -902,7 +891,7 @@ static QFuture<ArgsType<Signal>> connect(Sender *sender, Signal signal)
QObject::disconnect(connections->second);
promise.reportFinished();
});
- } else if constexpr (QtPrivate::isTupleV<ArgsType>) {
+ } else if constexpr (QtPrivate::ArgResolver<Signal>::HasExtraArgs) {
connections->first = QObject::connect(sender, signal, sender,
[promise, connections](auto... values) mutable {
QObject::disconnect(connections->first);