fix assertion - Assertion '_elementPool.CurrentAllocs() == _elementPool.Untracked()' failed.

This commit is contained in:
dinghao188
2021-09-17 17:49:01 +08:00
parent a977397684
commit 9efb6b0b66
2 changed files with 5 additions and 5 deletions

View File

@@ -1077,7 +1077,7 @@ char* XMLNode::ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr )
StrPair endTag;
p = node->ParseDeep( p, &endTag, curLineNumPtr );
if ( !p ) {
DeleteNode( node );
_document->DeleteNode( node );
if ( !_document->Error() ) {
_document->SetError( XML_ERROR_PARSING, initialLineNum, 0);
}
@@ -1110,7 +1110,7 @@ char* XMLNode::ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr )
}
if ( !wellLocated ) {
_document->SetError( XML_ERROR_PARSING_DECLARATION, initialLineNum, "XMLDeclaration value=%s", decl->Value());
DeleteNode( node );
_document->DeleteNode( node );
break;
}
}
@@ -1145,7 +1145,7 @@ char* XMLNode::ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr )
}
if ( mismatch ) {
_document->SetError( XML_ERROR_MISMATCHED_ELEMENT, initialLineNum, "XMLElement name=%s", ele->Name());
DeleteNode( node );
_document->DeleteNode( node );
break;
}
}

View File

@@ -2147,8 +2147,8 @@ int main( int argc, const char ** argv )
// successful loads should clear the error
XMLDocument doc;
XMLTest( "Should be no error initially", false, doc.Error() );
doc.LoadFile( "resources/no-such-file.xml" );
XMLTest( "No such file - should fail", true, doc.Error() );
doc.LoadFile( "resources/xmltest-5330.xml" );
XMLTest( "parse errors occur - should fail", true, doc.Error() );
doc.LoadFile( "resources/dream.xml" );
XMLTest( "Error should be cleared", false, doc.Error() );