Eeschema Eagle Import: memory leak fixes

This commit is contained in:
Maciej Suminski 2017-08-07 11:26:47 +02:00
parent 37445042ed
commit d4201ef51f
2 changed files with 7 additions and 7 deletions

View File

@ -1179,8 +1179,8 @@ EAGLE_LIBRARY SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode )
while( symbolNode ) while( symbolNode )
{ {
wxString symbolName = symbolNode->GetAttribute( "name" ); string symbolName = symbolNode->GetAttribute( "name" ).ToStdString();
elib.symbolnodes[symbolName.ToStdString()] = symbolNode; elib.symbolnodes[symbolName] = symbolNode;
symbolNode = symbolNode->GetNext(); symbolNode = symbolNode->GetNext();
} }
@ -1239,9 +1239,9 @@ EAGLE_LIBRARY SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode )
kpart->SetUnitCount( gates_count ); kpart->SetUnitCount( gates_count );
if(gates_count == 1 && ispower) kpart->SetPower(); if(gates_count == 1 && ispower) kpart->SetPower();
const string& name = kpart->GetName().ToStdString(); string name = kpart->GetName().ToStdString();
m_partlib->AddPart( kpart.get() ); m_partlib->AddPart( kpart.get() );
elib.kicadsymbols[name] = kpart.release(); elib.kicadsymbols.insert( name, kpart.release() );
deviceNode = deviceNode->GetNext(); deviceNode = deviceNode->GetNext();
} // devicenode } // devicenode
@ -1267,7 +1267,7 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode,
bool foundName = false; bool foundName = false;
bool foundValue = false; bool foundValue = false;
bool ispower = false; bool ispower = false;
int pincount; int pincount = 0;
while( currentNode ) while( currentNode )
{ {

View File

@ -69,8 +69,8 @@ class LIB_TEXT;
typedef struct EAGLE_LIBRARY typedef struct EAGLE_LIBRARY
{ {
std::string name; std::string name;
boost::ptr_map<std::string, LIB_PART*> kicadsymbols; boost::ptr_map<std::string, LIB_PART> kicadsymbols;
boost::ptr_map<std::string, wxXmlNode*> symbolnodes; std::unordered_map<std::string, wxXmlNode*> symbolnodes;
std::unordered_map<std::string, int> gate_unit; std::unordered_map<std::string, int> gate_unit;
std::unordered_map<std::string, std::string> package; std::unordered_map<std::string, std::string> package;