QPromise/QFutureInterface: in Qt 7 take std::exception_ptr by const-ref
std::exception_ptr is a reference-counted "smart pointer", so we shouldn't copy it around freely. Unfortunately QFutureInterface has exported functions taking it by value, so we can't just change the signatures and keep BC. Simply prepare the code for Qt 7. Change-Id: Ic5aae6a095c8c842872a40db440c99d2dfe371f1 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
This commit is contained in:
parent
524b957d1f
commit
49c5724cb8
@ -351,7 +351,11 @@ void QFutureInterfaceBase::reportException(const QException &exception)
|
||||
}
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
|
||||
void QFutureInterfaceBase::reportException(std::exception_ptr exception)
|
||||
#else
|
||||
void QFutureInterfaceBase::reportException(const std::exception_ptr &exception)
|
||||
#endif
|
||||
{
|
||||
QMutexLocker locker(&d->m_mutex);
|
||||
if (d->state.loadRelaxed() & (Canceled|Finished))
|
||||
|
@ -107,7 +107,11 @@ public:
|
||||
void reportCanceled();
|
||||
#ifndef QT_NO_EXCEPTIONS
|
||||
void reportException(const QException &e);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
|
||||
void reportException(std::exception_ptr e);
|
||||
#else
|
||||
void reportException(const std::exception_ptr &e);
|
||||
#endif
|
||||
#endif
|
||||
void reportResultsReady(int beginIndex, int endIndex);
|
||||
|
||||
|
@ -85,7 +85,11 @@ public:
|
||||
}
|
||||
#ifndef QT_NO_EXCEPTIONS
|
||||
void setException(const QException &e) { d.reportException(e); }
|
||||
#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
|
||||
void setException(std::exception_ptr e) { d.reportException(e); }
|
||||
#else
|
||||
void setException(const std::exception_ptr &e) { d.reportException(e); }
|
||||
#endif
|
||||
#endif
|
||||
void start() { d.reportStarted(); }
|
||||
void finish() { d.reportFinished(); }
|
||||
|
@ -142,10 +142,17 @@
|
||||
\sa isCanceled()
|
||||
*/
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
|
||||
/*! \fn template<typename T> void QPromise<T>::setException(std::exception_ptr e)
|
||||
|
||||
\overload
|
||||
*/
|
||||
#else
|
||||
/*! \fn template<typename T> void QPromise<T>::setException(const std::exception_ptr &e)
|
||||
|
||||
\overload
|
||||
*/
|
||||
#endif
|
||||
|
||||
/*! \fn template<typename T> void QPromise<T>::start()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user