summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <[email protected]>2021-03-11 19:27:53 +0100
committerGiuseppe D'Angelo <[email protected]>2021-03-14 18:28:39 +0100
commit4f4d7de499511cccab33b43aec432298cefd6364 (patch)
tree0d9b60c4e07c63666ab8c800e8de6bfd18ae655e
parentfaa6f19b2ae498b0fb74eb6ac25504db4bfd26c0 (diff)
QSslError: port to unique_ptr
So to avoid QScopedPointer::swap deprecation. Side note, QSslError is not implictly shared (although it should be, but that's a job for Qt 7). Change-Id: I42f7abffa81d72aac5af157074a0c3cbd20ba253 Reviewed-by: Edward Welbourne <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
-rw-r--r--src/network/ssl/qsslerror.cpp9
-rw-r--r--src/network/ssl/qsslerror.h5
2 files changed, 11 insertions, 3 deletions
diff --git a/src/network/ssl/qsslerror.cpp b/src/network/ssl/qsslerror.cpp
index 5e935adf097..6a4cef22edf 100644
--- a/src/network/ssl/qsslerror.cpp
+++ b/src/network/ssl/qsslerror.cpp
@@ -111,6 +111,11 @@
QT_BEGIN_NAMESPACE
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
+// Avoid an ABI break due to the QScopedPointer->std::unique_ptr change
+static_assert(sizeof(QScopedPointer<QSslErrorPrivate>) == sizeof(std::unique_ptr<QSslErrorPrivate>));
+#endif
+
class QSslErrorPrivate
{
public:
@@ -163,7 +168,7 @@ QSslError::QSslError(SslError error, const QSslCertificate &certificate)
QSslError::QSslError(const QSslError &other)
: d(new QSslErrorPrivate)
{
- *d.data() = *other.d.data();
+ *d.get() = *other.d.get();
}
/*!
@@ -180,7 +185,7 @@ QSslError::~QSslError()
*/
QSslError &QSslError::operator=(const QSslError &other)
{
- *d.data() = *other.d.data();
+ *d.get() = *other.d.get();
return *this;
}
diff --git a/src/network/ssl/qsslerror.h b/src/network/ssl/qsslerror.h
index f135dd10b74..a5865a5a336 100644
--- a/src/network/ssl/qsslerror.h
+++ b/src/network/ssl/qsslerror.h
@@ -45,6 +45,8 @@
#include <QtCore/qvariant.h>
#include <QtNetwork/qsslcertificate.h>
+#include <memory>
+
QT_BEGIN_NAMESPACE
@@ -120,7 +122,8 @@ public:
QSslCertificate certificate() const;
private:
- QScopedPointer<QSslErrorPrivate> d;
+ // ### Qt 7: make QSslError implicitly shared
+ std::unique_ptr<QSslErrorPrivate> d;
};
Q_DECLARE_SHARED(QSslError)