summaryrefslogtreecommitdiffstats
path: root/src/xml
diff options
context:
space:
mode:
Diffstat (limited to 'src/xml')
-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 571e7fb0ac..43e9034ee9 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -3625,7 +3625,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);
}