summaryrefslogtreecommitdiffstats
path: root/src/network/ssl/qsslkey_p.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/ssl/qsslkey_p.cpp')
-rw-r--r--src/network/ssl/qsslkey_p.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/network/ssl/qsslkey_p.cpp b/src/network/ssl/qsslkey_p.cpp
index b29b38beab..b0d6c729f9 100644
--- a/src/network/ssl/qsslkey_p.cpp
+++ b/src/network/ssl/qsslkey_p.cpp
@@ -385,6 +385,24 @@ QSslKey::QSslKey(const QSslKey &other) : d(other.d)
{
}
+QSslKey::QSslKey(QSslKey &&other) noexcept
+ : d(nullptr)
+{
+ qSwap(d, other.d);
+}
+
+QSslKey &QSslKey::operator=(QSslKey &&other) noexcept
+{
+ if (this == &other)
+ return *this;
+
+ // If no one else is referencing the key data we want to make sure
+ // before we swap the d-ptr that it is not left in memory.
+ d.reset();
+ qSwap(d, other.d);
+ return *this;
+}
+
/*!
Destroys the QSslKey object.
*/
@@ -490,8 +508,8 @@ QByteArray QSslKey::toPem(const QByteArray &passPhrase) const
}
/*!
- Returns a pointer to the native key handle, if it is available;
- otherwise a null pointer is returned.
+ Returns a pointer to the native key handle, if there is
+ one, else \nullptr.
You can use this handle together with the native API to access
extended information about the key.