summaryrefslogtreecommitdiffstats
path: root/src/corelib/concurrent
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@nokia.com>2010-11-11 09:59:53 +0100
committerMorten Johan Sørvig <morten.sorvig@nokia.com>2010-11-11 10:06:39 +0100
commit98d51e42c81c0674bc724eccbdf8521d9317998a (patch)
tree75605437441102ca180cfc2771d682b2ab6cab9f /src/corelib/concurrent
parente8ddca677db9b0d3ac8ff1b2079c3b000d59d6ec (diff)
Support exception handling in QtConcurrent::run()
Use QFutureInterface::reportException() in the same way that we do in QtConcurrent::map().
Diffstat (limited to 'src/corelib/concurrent')
-rw-r--r--src/corelib/concurrent/qtconcurrentrunbase.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/corelib/concurrent/qtconcurrentrunbase.h b/src/corelib/concurrent/qtconcurrentrunbase.h
index a6bbe3e0c3..a7a5cc4bc4 100644
--- a/src/corelib/concurrent/qtconcurrentrunbase.h
+++ b/src/corelib/concurrent/qtconcurrentrunbase.h
@@ -100,7 +100,19 @@ public:
this->reportFinished();
return;
}
- this->runFunctor();
+#ifndef QT_NO_EXCEPTIONS
+ try {
+#endif
+ this->runFunctor();
+#ifndef QT_NO_EXCEPTIONS
+ } catch (QtConcurrent::Exception &e) {
+ qDebug() << "cought exception";
+ QFutureInterface<T>::reportException(e);
+ } catch (...) {
+ QFutureInterface<T>::reportException(QtConcurrent::UnhandledException());
+ }
+#endif
+
this->reportResult(result);
this->reportFinished();
}
@@ -117,7 +129,17 @@ public:
this->reportFinished();
return;
}
- this->runFunctor();
+#ifndef QT_NO_EXCEPTIONS
+ try {
+#endif
+ this->runFunctor();
+#ifndef QT_NO_EXCEPTIONS
+ } catch (QtConcurrent::Exception &e) {
+ QFutureInterface<void>::reportException(e);
+ } catch (...) {
+ QFutureInterface<void>::reportException(QtConcurrent::UnhandledException());
+ }
+#endif
this->reportFinished();
}
};