Make sure PCB_PARSER is fully initialized between footprints.

Fixes https://gitlab.com/kicad/code/kicad/issues/9424
This commit is contained in:
Jeff Young 2021-10-19 17:01:22 +01:00
parent 75b5bcf46d
commit 57f907f6e7
1 changed files with 4 additions and 1 deletions

View File

@ -265,8 +265,11 @@ void FP_CACHE::Load()
FILE_LINE_READER reader( fn.GetFullPath() );
m_owner->m_parser->SetLineReader( &reader );
// Ensure a previous parsing does not interacts with the new parsing:
// For better or worse (mostly worse), the parser is a long-lived object.
// Make sure we start with a fresh state.
m_owner->m_parser->InitParserState();
m_owner->m_parser->SetBoard( nullptr ); // calls PCB_PARSER::init()
FOOTPRINT* footprint = (FOOTPRINT*) m_owner->m_parser->Parse();
wxString fpName = fn.GetName();