QFuture: fix headercheck warning with Clang 17: member shadowing
Pretty sure this is a Clang bug because the promise member that it says is getting shadowed shouldn't be in scope (`this` isn't being captured). qfuture_impl.h:538:60: error: declaration shadows a field of 'Continuation<Function, ResultType, ParentResultType>' [-Werror,-Wshadow] qfuture_impl.h:327:26: note: previous declaration is here Pick-to: 6.5 Change-Id: Ifeb6206a9fa04424964bfffd17883e21cfec6d8e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit bf7732baca43537b11ba8989d7e68fa9a9a6696d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
500b747bb9
commit
01bc132083
@ -535,18 +535,18 @@ void Continuation<Function, ResultType, ParentResultType>::create(F &&func,
|
||||
|
||||
fi.setLaunchAsync(launchAsync);
|
||||
|
||||
auto continuation = [func = std::forward<F>(func), fi, promise = QPromise(fi), pool,
|
||||
auto continuation = [func = std::forward<F>(func), fi, promise_ = QPromise(fi), pool,
|
||||
launchAsync](const QFutureInterfaceBase &parentData) mutable {
|
||||
const auto parent = QFutureInterface<ParentResultType>(parentData).future();
|
||||
Continuation<Function, ResultType, ParentResultType> *continuationJob = nullptr;
|
||||
if (launchAsync) {
|
||||
auto asyncJob = new AsyncContinuation<Function, ResultType, ParentResultType>(
|
||||
std::forward<Function>(func), parent, std::move(promise), pool);
|
||||
std::forward<Function>(func), parent, std::move(promise_), pool);
|
||||
fi.setRunnable(asyncJob);
|
||||
continuationJob = asyncJob;
|
||||
} else {
|
||||
continuationJob = new SyncContinuation<Function, ResultType, ParentResultType>(
|
||||
std::forward<Function>(func), parent, std::move(promise));
|
||||
std::forward<Function>(func), parent, std::move(promise_));
|
||||
}
|
||||
|
||||
bool isLaunched = continuationJob->execute();
|
||||
@ -573,11 +573,11 @@ void Continuation<Function, ResultType, ParentResultType>::create(F &&func,
|
||||
fi.setLaunchAsync(true);
|
||||
fi.setThreadPool(pool);
|
||||
|
||||
auto continuation = [func = std::forward<F>(func), promise = QPromise(fi),
|
||||
auto continuation = [func = std::forward<F>(func), promise_ = QPromise(fi),
|
||||
pool](const QFutureInterfaceBase &parentData) mutable {
|
||||
const auto parent = QFutureInterface<ParentResultType>(parentData).future();
|
||||
auto continuationJob = new AsyncContinuation<Function, ResultType, ParentResultType>(
|
||||
std::forward<Function>(func), parent, std::move(promise), pool);
|
||||
std::forward<Function>(func), parent, std::move(promise_), pool);
|
||||
bool isLaunched = continuationJob->execute();
|
||||
// If continuation is successfully launched, AsyncContinuation will be deleted
|
||||
// by the QThreadPool which has started it.
|
||||
@ -615,9 +615,9 @@ void Continuation<Function, ResultType, ParentResultType>::create(F &&func,
|
||||
// continuation callback is destroyed. The promise that is created in the capture list is
|
||||
// destroyed and, if it is not yet finished, cancelled.
|
||||
auto continuation = [func = std::forward<F>(func), parent = *f,
|
||||
promise = QPromise(fi)]() mutable {
|
||||
promise_ = QPromise(fi)]() mutable {
|
||||
SyncContinuation<Function, ResultType, ParentResultType> continuationJob(
|
||||
std::forward<Function>(func), parent, std::move(promise));
|
||||
std::forward<Function>(func), parent, std::move(promise_));
|
||||
continuationJob.execute();
|
||||
};
|
||||
|
||||
@ -687,11 +687,11 @@ void FailureHandler<Function, ResultType>::create(F &&function, QFuture<ResultTy
|
||||
{
|
||||
Q_ASSERT(future);
|
||||
|
||||
auto failureContinuation = [function = std::forward<F>(function), promise = QPromise(fi)](
|
||||
auto failureContinuation = [function = std::forward<F>(function), promise_ = QPromise(fi)](
|
||||
const QFutureInterfaceBase &parentData) mutable {
|
||||
const auto parent = QFutureInterface<ResultType>(parentData).future();
|
||||
FailureHandler<Function, ResultType> failureHandler(std::forward<Function>(function),
|
||||
parent, std::move(promise));
|
||||
parent, std::move(promise_));
|
||||
failureHandler.run();
|
||||
};
|
||||
|
||||
@ -707,9 +707,9 @@ void FailureHandler<Function, ResultType>::create(F &&function, QFuture<ResultTy
|
||||
Q_ASSERT(future);
|
||||
Q_ASSERT(context);
|
||||
auto failureContinuation = [function = std::forward<F>(function),
|
||||
parent = *future, promise = QPromise(fi)]() mutable {
|
||||
parent = *future, promise_ = QPromise(fi)]() mutable {
|
||||
FailureHandler<Function, ResultType> failureHandler(
|
||||
std::forward<Function>(function), parent, std::move(promise));
|
||||
std::forward<Function>(function), parent, std::move(promise_));
|
||||
failureHandler.run();
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user