diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2020-10-16 12:25:13 +0200 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2020-10-26 14:27:02 +0100 |
commit | 4c793e6353ece51d4c04373f54e13d540b45195e (patch) | |
tree | 6aa9367b84ec9ace22dfe6e9a2cde4172ac3a379 /src/concurrent | |
parent | 1aa3459d0a534473582806b0988d26533bc7e16a (diff) |
Store std::exception_ptr in QUnhandledException
For historical reasons Qt Concurrent reports QUnhandledException in
case if an exception that is not derived from QException is thrown
from a worker thread. Changing this behavior may not be a good idea,
since the existing user code may rely on it. Changed QUnhandledException
to wrap the std::exception_ptr to the actual exception, so that the
users can obtain the information about the thrown exception if needed.
[ChangeLog][QtCore][QUnhandledException] Improved QUnhandledException to
store the std::exception_ptr to the actual exception thrown from a
QtCocnurrent worker thread.
Change-Id: I30e7c1d3e01aff6e1ed9938c421da0a888f12066
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/concurrent')
-rw-r--r-- | src/concurrent/qtconcurrentrunbase.h | 2 | ||||
-rw-r--r-- | src/concurrent/qtconcurrentthreadengine.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/concurrent/qtconcurrentrunbase.h b/src/concurrent/qtconcurrentrunbase.h index c748d8e2b9..20267a2d5b 100644 --- a/src/concurrent/qtconcurrentrunbase.h +++ b/src/concurrent/qtconcurrentrunbase.h @@ -114,7 +114,7 @@ public: } catch (QException &e) { promise.reportException(e); } catch (...) { - promise.reportException(QUnhandledException()); + promise.reportException(QUnhandledException(std::current_exception())); } #endif diff --git a/src/concurrent/qtconcurrentthreadengine.cpp b/src/concurrent/qtconcurrentthreadengine.cpp index 081018fbcc..fcc504a96c 100644 --- a/src/concurrent/qtconcurrentthreadengine.cpp +++ b/src/concurrent/qtconcurrentthreadengine.cpp @@ -196,7 +196,7 @@ void ThreadEngineBase::startBlocking() } catch (QException &e) { handleException(e); } catch (...) { - handleException(QUnhandledException()); + handleException(QUnhandledException(std::current_exception())); } #endif @@ -325,7 +325,7 @@ void ThreadEngineBase::run() // implements QRunnable. } catch (QException &e) { handleException(e); } catch (...) { - handleException(QUnhandledException()); + handleException(QUnhandledException(std::current_exception())); } #endif threadExit(); |