TinyXML seg fault

时间:2012-08-07 07:16:07

标签: c++ tinyxml

是否存在与tinyXML相关的固有内存泄漏问题?我不知道为什么我会遇到这种奇怪的错误。 在以下函数中,每当我尝试增加元素名称的大小(“Connecor”&“laneFro”)时,以下if子句(在循环中)会导致程序崩溃。

void WriteXMLInput_Node_Connectors(Node* node,TiXmlElement * Node_)
{
    std::ostringstream out;
    TiXmlElement * Connectors = new TiXmlElement("Connectors"); Node_->LinkEndChild(Connectors);
    TiXmlElement * Connector;
    TiXmlElement * laneFrom;
    TiXmlElement * laneTo;

    for(std::map<const sim_mob::Lane*, sim_mob::Lane* >::const_iterator it = node->getConnectors().begin();it != (node->getConnectors().end()); it++)
    {
        Connector = new TiXmlElement("Connecor"); Connectors->LinkEndChild(Connector);
        laneFrom = new TiXmlElement("laneFro"); Connector->LinkEndChild(laneFrom);
//      laneTo = new TiXmlElement("laneTo"); Connector->LinkEndChild(laneTo);
        if(42792 == node->getID())
        {
            std::cout << "uninode " ;
            std::cout << uninode->getID();
            std::cout << " from: " << (*it).first << " ";
            std::cout << (*it).first->getLaneID_str();
            std::cout << "uninode " << uninode->getID() << " To: " << (*it).second->getLaneID_str();

    }
}

谢谢

0 个答案:

没有答案