标签:
1 TiXmlNode::~TiXmlNode() 2 { 3 TiXmlNode* node = firstChild; 4 TiXmlNode* temp = 0; 5 6 while ( node ) 7 { 8 temp = node; 9 node = node->next; 10 delete temp; 11 } 12 }
所以我的观点是以后在用tinyxml时,TixmlDocument最好在栈上创建,其子节点都应用new在堆上创建,否则在TixmlDocument析构的时候不会将子节点销毁
标签:
原文地址:http://www.cnblogs.com/lpxblog/p/5644387.html