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>
This commit is contained in:
Volker Krause 2016-01-12 10:40:43 +01:00
parent 7b63c45df5
commit b5447f9c33

View File

@ -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;
}