From 418229dc5ca6943294378556a0208578dd48064a Mon Sep 17 00:00:00 2001 From: Lee Thomason Date: Mon, 9 Mar 2026 18:02:29 -0700 Subject: [PATCH 1/3] fix bad merge --- tinyxml2.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tinyxml2.cpp b/tinyxml2.cpp index a0a0b23..56faecb 100644 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -2348,11 +2348,10 @@ static FILE* callfopen( const char* filepath, const char* mode ) } void XMLDocument::DeleteNode( XMLNode* node ) { - TIXMLASSERT( node ); - TIXMLASSERT(node->_document == this ); if(node == 0) { return; // check for null pointer } + TIXMLASSERT(node->_document == this); if (node->_parent) { node->_parent->DeleteChild( node ); } From 3dcad8e3c38e7091ae3771bf63020027f91715ce Mon Sep 17 00:00:00 2001 From: Lee Thomason Date: Mon, 9 Mar 2026 18:09:58 -0700 Subject: [PATCH 2/3] fix merge (#1066) From 8d8472fe1a95e938577c60343dd0fae24932ddeb Mon Sep 17 00:00:00 2001 From: Lee Thomason Date: Sat, 23 May 2026 16:13:32 -0700 Subject: [PATCH 3/3] Improved XMLNode::~XMLNode perfomance (#1075) Improved XMLNode::~XMLNode perfomance (#1075) --- tinyxml2.cpp | 12 +++++++++++- tinyxml2.h | 8 -------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/tinyxml2.cpp b/tinyxml2.cpp index 56faecb..ad5bc87 100644 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -834,7 +834,17 @@ XMLNode::XMLNode( XMLDocument* doc ) : 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 ) { _parent->Unlink( this ); } diff --git a/tinyxml2.h b/tinyxml2.h index c801117..6dd1510 100644 --- a/tinyxml2.h +++ b/tinyxml2.h @@ -42,14 +42,6 @@ distribution. #endif #include -/* - gcc: - g++ -Wall -DTINYXML2_DEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe - - Formatting, Artistic Style: - AStyle.exe --style=1tbs --indent-switches --break-closing-brackets --indent-preprocessor tinyxml2.cpp tinyxml2.h -*/ - #if defined( _DEBUG ) || defined (__DEBUG__) # ifndef TINYXML2_DEBUG # define TINYXML2_DEBUG