From 73e1bc09e63394490d91a223b3479b46c1595d66 Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Mon, 20 Jun 2022 16:19:24 +0200 Subject: [PATCH] Move QFutureInterfaceBase::cleanContinuation() to removed_api This method isn't used anymore, but we can't remove it entirely for BC reasons, because it was called from inline code. Pick-to: 6.4 Change-Id: I9183c666c466030787ac7c2386706b50abf23eaa Reviewed-by: Marc Mutz Reviewed-by: Qt CI Bot --- src/corelib/compat/removed_api.cpp | 17 +++++++++++++++++ src/corelib/thread/qfutureinterface.cpp | 12 ------------ src/corelib/thread/qfutureinterface.h | 2 ++ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/corelib/compat/removed_api.cpp b/src/corelib/compat/removed_api.cpp index 87dbe3c9166..d56ea9f43af 100644 --- a/src/corelib/compat/removed_api.cpp +++ b/src/corelib/compat/removed_api.cpp @@ -169,6 +169,23 @@ QCalendar::QCalendar(QStringView name) QCalendar::QCalendar(QLatin1StringView name) : QCalendar(QAnyStringView{name}) {} +#if QT_CONFIG(future) + +#include "qfutureinterface.h" +#include "private/qfutureinterface_p.h" + +void QFutureInterfaceBase::cleanContinuation() +{ + if (!d) + return; + + // This was called when the associated QPromise was being destroyed, + // but isn't used anymore. + QMutexLocker lock(&d->continuationMutex); + d->continuation = nullptr; +} + +#endif // QT_CONFIG(future) #include "qhashfunctions.h" diff --git a/src/corelib/thread/qfutureinterface.cpp b/src/corelib/thread/qfutureinterface.cpp index 8cdc10a94b6..a82b7af8734 100644 --- a/src/corelib/thread/qfutureinterface.cpp +++ b/src/corelib/thread/qfutureinterface.cpp @@ -829,18 +829,6 @@ void QFutureInterfaceBase::setContinuation(std::functioncontinuationMutex); - d->continuation = nullptr; -} - void QFutureInterfaceBase::runContinuation() const { QMutexLocker lock(&d->continuationMutex); diff --git a/src/corelib/thread/qfutureinterface.h b/src/corelib/thread/qfutureinterface.h index eb251c7d142..820faa9ec20 100644 --- a/src/corelib/thread/qfutureinterface.h +++ b/src/corelib/thread/qfutureinterface.h @@ -183,7 +183,9 @@ protected: void setContinuation(std::function func); void setContinuation(std::function func, QFutureInterfaceBasePrivate *continuationFutureData); +#if QT_CORE_REMOVED_SINCE(6, 4) void cleanContinuation(); +#endif void runContinuation() const; void setLaunchAsync(bool value);