From e770728a336d3218ad8b13c04bbea3324d241b48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Tue, 12 Jan 2016 00:21:26 +0000 Subject: Add Qt6 TODO to remove copy-assign operator and copy-ctor Change-Id: I5d80b272f31ada58d4eb7c19051fe447d6241633 Reviewed-by: Marc Mutz --- src/corelib/thread/qexception.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/thread') diff --git a/src/corelib/thread/qexception.h b/src/corelib/thread/qexception.h index b15ae5095a..dc988f9020 100644 --- a/src/corelib/thread/qexception.h +++ b/src/corelib/thread/qexception.h @@ -86,7 +86,7 @@ class Q_CORE_EXPORT ExceptionHolder public: ExceptionHolder(QException *exception = Q_NULLPTR); ExceptionHolder(const ExceptionHolder &other); - void operator=(const ExceptionHolder &other); + void operator=(const ExceptionHolder &other); // ### Qt6: copy-assign operator shouldn't return void. Remove this method and the copy-ctor, they are unneeded. ~ExceptionHolder(); QException *exception() const; QExplicitlySharedDataPointer base; -- cgit v1.2.3 From b5447f9c331cf5367ac7a35f57e5099c5c100b73 Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Tue, 12 Jan 2016 10:40:43 +0100 Subject: 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 --- src/corelib/thread/qexception.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/corelib/thread') 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; } -- cgit v1.2.3 From 50073521649e3818d87920751ab95acd2c2dfd15 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 18 Jan 2016 12:38:36 +0100 Subject: QOrderedMutexLocker: use std::less to prevent undefined behavior operator< between pointers is undefined unless the two pointers point in the same array, which is not what QOrderedMutexLocker does. Change-Id: Ia6594900cfa807a73f20e157ce896b4321a3d746 Reviewed-by: Marc Mutz --- src/corelib/thread/qorderedmutexlocker_p.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/corelib/thread') diff --git a/src/corelib/thread/qorderedmutexlocker_p.h b/src/corelib/thread/qorderedmutexlocker_p.h index c73a790820..54887342e7 100644 --- a/src/corelib/thread/qorderedmutexlocker_p.h +++ b/src/corelib/thread/qorderedmutexlocker_p.h @@ -47,6 +47,8 @@ #include +#include + QT_BEGIN_NAMESPACE /* @@ -57,8 +59,8 @@ class QOrderedMutexLocker { public: QOrderedMutexLocker(QMutex *m1, QMutex *m2) - : mtx1((m1 == m2) ? m1 : (m1 < m2 ? m1 : m2)), - mtx2((m1 == m2) ? 0 : (m1 < m2 ? m2 : m1)), + : mtx1((m1 == m2) ? m1 : (std::less()(m1, m2) ? m1 : m2)), + mtx2((m1 == m2) ? 0 : (std::less()(m1, m2) ? m2 : m1)), locked(false) { relock(); -- cgit v1.2.3