Don't let the flattened symbol go out of scope before we're done with it.

Fixes https://gitlab.com/kicad/code/kicad/issues/6760
This commit is contained in:
Jeff Young 2020-12-16 17:58:55 +00:00
parent 625e239abf
commit 5761666ad6
1 changed files with 5 additions and 1 deletions

View File

@ -266,10 +266,14 @@ void DIALOG_CHANGE_SYMBOLS::updateFieldsList()
if( m_mode == MODE::UPDATE && symbol->GetPartRef() )
{
symbol->GetPartRef()->Flatten()->GetFields( libFields );
std::unique_ptr<LIB_PART> flattenedPart = symbol->GetPartRef()->Flatten();
flattenedPart->GetFields( libFields );
for( unsigned i = MANDATORY_FIELDS; i < libFields.size(); ++i )
fieldNames.insert( libFields[i]->GetName() );
libFields.clear(); // flattenedPart is about to go out of scope...
}
}
}