summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qfutureinterface.cpp
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2020-03-26 13:22:46 +0100
committerSona Kurazyan <sona.kurazyan@qt.io>2020-04-01 21:51:06 +0200
commit495f958b9ac5c45196e743fcba300fcfd25b90a3 (patch)
treeeb24af3b1fffb770328b11dfccdfc3c783e7ff76 /src/corelib/thread/qfutureinterface.cpp
parent7909de1bebe3bac32286513025fc00220cd29ec1 (diff)
Store QFuture exceptions as std::exception_ptr
Replaced the internal ExceptionHolder for storing QException* by std::exception_ptr. This will allow to report and store exceptions of types that are not derived from QException. Task-number: QTBUG-81588 Change-Id: I96be919d8289448b3e608310e51a16cebc586301 Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/corelib/thread/qfutureinterface.cpp')
-rw-r--r--src/corelib/thread/qfutureinterface.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/corelib/thread/qfutureinterface.cpp b/src/corelib/thread/qfutureinterface.cpp
index 9d00bc3271..92b2df7c15 100644
--- a/src/corelib/thread/qfutureinterface.cpp
+++ b/src/corelib/thread/qfutureinterface.cpp
@@ -283,6 +283,15 @@ void QFutureInterfaceBase::reportCanceled()
#ifndef QT_NO_EXCEPTIONS
void QFutureInterfaceBase::reportException(const QException &exception)
{
+ try {
+ exception.raise();
+ } catch (...) {
+ reportException(std::current_exception());
+ }
+}
+
+void QFutureInterfaceBase::reportException(std::exception_ptr exception)
+{
QMutexLocker locker(&d->m_mutex);
if (d->state.loadRelaxed() & (Canceled|Finished))
return;