Commit b5447f9c authored by Volker Krause's avatar Volker Krause
Browse files

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: default avatarMarc Mutz <marc.mutz@kdab.com>
parent 7b63c45d
Branches
Tags
No related merge requests found
Showing with 3 additions and 1 deletion
......@@ -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;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment