summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/xml/dom/qdom.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index c54f4a0bc8..ba37374f75 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -3619,7 +3619,9 @@ void QDomAttrPrivate::setNodeValue(const QString& v)
// keep the refcount balanced: appendChild() does a ref anyway.
t->ref.deref();
if (first) {
- delete removeChild(first);
+ auto removed = removeChild(first);
+ if (removed && !removed->ref)
+ delete removed;
}
appendChild(t);
}