mirror of
https://github.com/leethomason/tinyxml2.git
synced 2026-07-25 21:23:00 +04:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ce9f9a3a7 | |||
| 682fda289f | |||
| e6a464942f | |||
| fc99428a82 |
+11
-3
@@ -834,7 +834,17 @@ XMLNode::XMLNode( XMLDocument* doc ) :
|
|||||||
|
|
||||||
XMLNode::~XMLNode()
|
XMLNode::~XMLNode()
|
||||||
{
|
{
|
||||||
DeleteChildren();
|
// Fast path: this node is dying, so maintaining _firstChild/_lastChild and
|
||||||
|
// sibling _prev/_next links is unnecessary. Only _parent must be zeroed to
|
||||||
|
// satisfy the MarkInUse assertion inside DeleteNode.
|
||||||
|
XMLNode *currentChild = _firstChild;
|
||||||
|
while (currentChild != NULL) {
|
||||||
|
XMLNode *next = currentChild->_next;
|
||||||
|
currentChild->_parent = 0;
|
||||||
|
DeleteNode(currentChild);
|
||||||
|
currentChild = next;
|
||||||
|
}
|
||||||
|
|
||||||
if ( _parent ) {
|
if ( _parent ) {
|
||||||
_parent->Unlink( this );
|
_parent->Unlink( this );
|
||||||
}
|
}
|
||||||
@@ -2348,8 +2358,6 @@ static FILE* callfopen( const char* filepath, const char* mode )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void XMLDocument::DeleteNode( XMLNode* node ) {
|
void XMLDocument::DeleteNode( XMLNode* node ) {
|
||||||
TIXMLASSERT( node );
|
|
||||||
TIXMLASSERT(node->_document == this );
|
|
||||||
if(node == 0) {
|
if(node == 0) {
|
||||||
return; // check for null pointer
|
return; // check for null pointer
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user