summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2011-03-25 18:24:35 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2011-03-28 13:02:46 (GMT)
commit383da4084ae0cd8dcb9777cbfa90a55c56f7ad09 (patch)
treec7eaf2ab79f3583b7b62145be34ab1c28bccb22d
parent57909eb88ff571fba18459045bd0f8344b32247a (diff)
downloadQt-383da4084ae0cd8dcb9777cbfa90a55c56f7ad09.zip
Qt-383da4084ae0cd8dcb9777cbfa90a55c56f7ad09.tar.gz
Qt-383da4084ae0cd8dcb9777cbfa90a55c56f7ad09.tar.bz2
QtConcurrent: throw exception from destructor
Task-number: QTBUG-18149 Reviewed-by: Morten Sorvig
-rw-r--r--src/corelib/concurrent/qtconcurrentexception.cpp7
-rw-r--r--tests/auto/qfuture/tst_qfuture.cpp28
2 files changed, 29 insertions, 6 deletions
diff --git a/src/corelib/concurrent/qtconcurrentexception.cpp b/src/corelib/concurrent/qtconcurrentexception.cpp
index 948269a..b4123f5 100644
--- a/src/corelib/concurrent/qtconcurrentexception.cpp
+++ b/src/corelib/concurrent/qtconcurrentexception.cpp
@@ -203,12 +203,7 @@ ExceptionHolder ExceptionStore::exception()
void ExceptionStore::throwPossibleException()
{
- /* On win32-g++, with GCC 3.4.2 std::uncaught_exception() isn't reliable. */
- if (hasException()
-#ifndef Q_CC_MINGW
- && std::uncaught_exception() == false
-#endif
- ) {
+ if (hasException() ) {
exceptionHolder.base->hasThrown = true;
exceptionHolder.exception()->raise();
}
diff --git a/tests/auto/qfuture/tst_qfuture.cpp b/tests/auto/qfuture/tst_qfuture.cpp
index fa4ccb5..8afdf48 100644
--- a/tests/auto/qfuture/tst_qfuture.cpp
+++ b/tests/auto/qfuture/tst_qfuture.cpp
@@ -81,6 +81,7 @@ private slots:
void voidConversions();
#ifndef QT_NO_EXCEPTIONS
void exceptions();
+ void exceptions_QTBUG18149();
#endif
};
@@ -1431,6 +1432,33 @@ void tst_QFuture::exceptions()
}
+
+void tst_QFuture::exceptions_QTBUG18149()
+{
+ class MyClass
+ {
+ public:
+ ~MyClass()
+ {
+ QFuture<void> f = createExceptionFuture();
+ bool caught = false;
+ try {
+ f.waitForFinished();
+ } catch (Exception &) {
+ caught = true;
+ }
+ QVERIFY(caught);
+ }
+ };
+
+ try {
+ MyClass m;
+ throw 0;
+ } catch (int) {}
+
+}
+
+
#endif // QT_NO_EXCEPTIONS
#include "tst_qfuture.moc"