Sorry for the confusion. I remembered incorrectly from the distant past.
Meanwhile I had a look at the sources (5.1 but shouldn't have changed).
As you'll have seen from your debugging, clear() simply calls the impl dtor[*]:
{
if (impl && !impl->ref.deref())
delete impl;
impl = 0;
}
void QDomNode::clear()
{
if (impl && !impl->ref.deref())
delete impl;
impl = 0;
}
To copy to clipboard, switch view to plain text mode
The dtor indeed iterates the children, thus traversing the tree[*]:
QDomNodePrivate::~QDomNodePrivate()
{
QDomNodePrivate* p = first;
QDomNodePrivate* n;
while (p) {
n = p->next;
if (!p->ref.deref())
delete p;
else
p->setNoParent();
p = n;
}
first = 0;
last = 0;
}
QDomNodePrivate::~QDomNodePrivate()
{
QDomNodePrivate* p = first;
QDomNodePrivate* n;
while (p) {
n = p->next;
if (!p->ref.deref())
delete p;
else
p->setNoParent();
p = n;
}
first = 0;
last = 0;
}
To copy to clipboard, switch view to plain text mode
[*] I'm not sure what exactly deref() does, but if I interpret the asm correctly, it simply decrements the ref count and returns false if there are no references left, true otherwise. In the latter case deletion traversal terminates, and the node's subtree will dangle in the sense that it remains owned by the doc but is child of this node no more.
My conclusion is, if not all of your "row" is deleted, there must be reference(s) to its descendant(s). This is in accordance with the doc cited in post #2.
If you provided relevant parts of your code there might be a chance to locate the culprit.
Bookmarks