aboutsummaryrefslogtreecommitdiff
path: root/src/base/QXmppElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/base/QXmppElement.cpp')
-rw-r--r--src/base/QXmppElement.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/base/QXmppElement.cpp b/src/base/QXmppElement.cpp
index 4c6c7f9c..0d6c36e7 100644
--- a/src/base/QXmppElement.cpp
+++ b/src/base/QXmppElement.cpp
@@ -123,10 +123,13 @@ QXmppElement::~QXmppElement()
QXmppElement &QXmppElement::operator=(const QXmppElement &other)
{
- other.d->counter.ref();
- if (!d->counter.deref())
- delete d;
- d = other.d;
+ if (this != &other) // self-assignment check
+ {
+ other.d->counter.ref();
+ if (!d->counter.deref())
+ delete d;
+ d = other.d;
+ }
return *this;
}