summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorVolker Krause <volker.krause@kdab.com>2016-01-12 10:40:43 +0100
committerVolker Krause <volker.krause@kdab.com>2016-01-13 22:06:25 +0000
commitb5447f9c331cf5367ac7a35f57e5099c5c100b73 (patch)
tree8e2ad953c2bb902dd5416dfda96ce0f6e2645aa4 /src/corelib
parent7b63c45df58a97bb3e800dd5fe20f41e11f92c62 (diff)
QtConcurrent: Avoid an allocation in ExceptionHolder if there is no exception to store.
Qt3D hits this several times per frame. Change-Id: Iaadcfbe79f146bd73b36f01325580dc24a10225c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/thread/qexception.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/thread/qexception.cpp b/src/corelib/thread/qexception.cpp
index 04a03b8623..cecd69c273 100644
--- a/src/corelib/thread/qexception.cpp
+++ b/src/corelib/thread/qexception.cpp
@@ -165,7 +165,7 @@ public:
};
ExceptionHolder::ExceptionHolder(QException *exception)
-: base(new Base(exception)) {}
+: base(exception ? new Base(exception) : Q_NULLPTR) {}
ExceptionHolder::ExceptionHolder(const ExceptionHolder &other)
: base(other.base)
@@ -181,6 +181,8 @@ ExceptionHolder::~ExceptionHolder()
QException *ExceptionHolder::exception() const
{
+ if (!base)
+ return Q_NULLPTR;
return base->exception;
}