summaryrefslogtreecommitdiffstats
path: root/src/network/ssl/qsslkey.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/ssl/qsslkey.cpp')
-rw-r--r--src/network/ssl/qsslkey.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/network/ssl/qsslkey.cpp b/src/network/ssl/qsslkey.cpp
index 8d550c0..d076112 100644
--- a/src/network/ssl/qsslkey.cpp
+++ b/src/network/ssl/qsslkey.cpp
@@ -269,7 +269,7 @@ QSslKey::QSslKey(QIODevice *device, QSsl::KeyAlgorithm algorithm, QSsl::Encoding
/*!
Constructs an identical copy of \a other.
*/
-QSslKey::QSslKey(const QSslKey &other) : d(other.d)
+QSslKey::QSslKey(const QSslKey &other) : d(other.d.data())
{
d->ref.ref();
}
@@ -279,8 +279,6 @@ QSslKey::QSslKey(const QSslKey &other) : d(other.d)
*/
QSslKey::~QSslKey()
{
- if (!d->ref.deref())
- delete d;
}
/*!
@@ -291,7 +289,7 @@ QSslKey::~QSslKey()
*/
QSslKey &QSslKey::operator=(const QSslKey &other)
{
- qAtomicAssign(d, other.d);
+ d.assign(other.d.data());
return *this;
}
@@ -312,10 +310,13 @@ bool QSslKey::isNull() const
*/
void QSslKey::clear()
{
- if (!d->ref.deref()) {
- delete d;
- d = new QSslKeyPrivate;
- }
+ d.reset(new QSslKeyPrivate);
+
+ //### old code: is this really correct???
+ //if (!d->ref.deref()) {
+ // delete d;
+ // d = new QSslKeyPrivate;
+ //}
}
/*!