summaryrefslogtreecommitdiffstats
path: root/src/xml/dom
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2024-03-01 22:02:47 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2024-03-02 21:22:53 +0100
commitde0230467c1f658232b101a99e62d68992173592 (patch)
tree6695d79a9e9300e01261fa763644007d0c6fe6cb /src/xml/dom
parent398a51686eda225f222d9df7ce56898c18ecdaa1 (diff)
QtXml: fix leak in QDomText::splitText
QDomText::splitText() needs to unref() the newly created QDomText instance as it does not use it by itself Pick-to: 6.7 6.6 6.5 6.2 5.15 Fixes: QTBUG-40561 Change-Id: I593011b63c39f2310204d97ec61da7cf78a0fc14 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/xml/dom')
-rw-r--r--src/xml/dom/qdom.cpp4
-rw-r--r--src/xml/dom/qdom.h3
2 files changed, 7 insertions, 0 deletions
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index 6e5e59bd99..2ac044004e 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -4671,6 +4671,10 @@ QDomTextPrivate* QDomTextPrivate::splitText(int offset)
value.truncate(offset);
parent()->insertAfter(t, this);
+ Q_ASSERT(t->ref.loadRelaxed() == 2);
+
+ // We are not interested in this node
+ t->ref.deref();
return t;
}
diff --git a/src/xml/dom/qdom.h b/src/xml/dom/qdom.h
index 4f01f92353..a3900609c4 100644
--- a/src/xml/dom/qdom.h
+++ b/src/xml/dom/qdom.h
@@ -7,6 +7,8 @@
#include <QtXml/qtxmlglobal.h>
#include <QtCore/qstring.h>
+class tst_QDom;
+
QT_BEGIN_NAMESPACE
@@ -201,6 +203,7 @@ protected:
QDomNode(QDomNodePrivate*);
private:
+ friend class ::tst_QDom;
friend class QDomDocument;
friend class QDomDocumentType;
friend class QDomNodeList;