Fix a double deletion in QDomAttr::setNodeValue()
Check the reference count before deleting. Patch as contributed on bug report. Pick-to: 5.15 5.12 Fixes: QTBUG-86547 Change-Id: I2cb197e3eeda7ade2442c23f6b4f1ae6ff2ff810 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
1dbaf037a8
commit
af22ccf560
@ -3625,7 +3625,9 @@ void QDomAttrPrivate::setNodeValue(const QString& v)
|
|||||||
// keep the refcount balanced: appendChild() does a ref anyway.
|
// keep the refcount balanced: appendChild() does a ref anyway.
|
||||||
t->ref.deref();
|
t->ref.deref();
|
||||||
if (first) {
|
if (first) {
|
||||||
delete removeChild(first);
|
auto removed = removeChild(first);
|
||||||
|
if (removed && !removed->ref)
|
||||||
|
delete removed;
|
||||||
}
|
}
|
||||||
appendChild(t);
|
appendChild(t);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user