Fix missing part library broken by schematic I/O plugin changes.

The LIB_PART object stores a pointer to the PART_LIB that it belongs to.
Now that the PART_LIB is no long responsible for loading the library, add
the PART_LIB pointer after the library is loaded by the plugin.
This commit is contained in:
Wayne Stambaugh 2017-01-28 16:59:09 -05:00
parent fda677eecc
commit ebfbbcc1f5
1 changed files with 12 additions and 2 deletions

View File

@ -302,10 +302,20 @@ PART_LIB* PART_LIB::LoadLibrary( const wxString& aFileName ) throw( IO_ERROR, bo
wxArrayString tmp; wxArrayString tmp;
// This loads the library although we could probably do lazy loading. // This loads the library although we could probably do lazy loading.
lib->GetCount(); lib->GetAliasNames( tmp );
// This not them most efficient way to set the LIB_PART m_library member but it will
// only be used when loading legacy libraries in the future. Once the symbols in the
// schematic have a full #LIB_ID, this will not get called.
for( size_t i = 0; i < tmp.GetCount(); i++ )
{
LIB_ALIAS* alias = lib->FindAlias( tmp[i] );
if( alias && alias->GetPart() )
alias->GetPart()->SetLib( lib.get() );
}
PART_LIB* ret = lib.release(); PART_LIB* ret = lib.release();
return ret; return ret;
} }