Fixed crashes when importing an Eagle schematic

If release() is called on a unique_ptr, one needs to be sure
that is not dereferenced anymore.
This commit is contained in:
Maciej Suminski 2017-07-03 16:00:01 +02:00
parent d6383893a2
commit deaa1d1477
1 changed files with 6 additions and 3 deletions

View File

@ -281,8 +281,9 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
wxXmlNode* partNode = schematicChildren["parts"]->GetChildren();
while( partNode )
{
std::unique_ptr<EPART> epart( new EPART(partNode) );
m_partlist[epart.get()->name] = epart.release();
std::unique_ptr<EPART> epart( new EPART( partNode ) );
const string& name = epart->name;
m_partlist[name] = epart.release();
partNode = partNode->GetNext();
}
@ -720,7 +721,9 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode )
kpart->SetUnitCount(gates_count);
elib->kicadsymbols[kpart->GetName().ToStdString()] = kpart.release();
const string& name = kpart->GetName().ToStdString();
m_partlib->AddPart( kpart.get() );
elib->kicadsymbols[name] = kpart.release();
deviceNode = deviceNode->GetNext();
} // devicenode