Defensive code to prevent lookup of stale parent board.
Fixes https://gitlab.com/kicad/code/kicad/issues/6618
This commit is contained in:
parent
fd5e1fbdd4
commit
f3e1ac8dbe
|
@ -160,9 +160,6 @@ FOOTPRINT::FOOTPRINT( const FOOTPRINT& aFootprint ) :
|
|||
|
||||
m_arflag = 0;
|
||||
|
||||
// Ensure auxiliary data is up to date
|
||||
CalculateBoundingBox();
|
||||
|
||||
m_initial_comments = aFootprint.m_initial_comments ?
|
||||
new wxArrayString( *aFootprint.m_initial_comments ) : nullptr;
|
||||
}
|
||||
|
|
|
@ -2847,7 +2847,9 @@ FOOTPRINT* EAGLE_PLUGIN::FootprintLoad( const wxString& aLibraryPath,
|
|||
return NULL;
|
||||
|
||||
// Return a copy of the template
|
||||
return (FOOTPRINT*) it->second->Duplicate();
|
||||
FOOTPRINT* copy = (FOOTPRINT*) it->second->Duplicate();
|
||||
copy->SetParent( nullptr );
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -936,7 +936,15 @@ FOOTPRINT* GPCB_PLUGIN::FootprintLoad( const wxString& aLibraryPath,
|
|||
const PROPERTIES* aProperties )
|
||||
{
|
||||
const FOOTPRINT* footprint = getFootprint( aLibraryPath, aFootprintName, aProperties, true );
|
||||
return footprint ? (FOOTPRINT*) footprint->Duplicate() : nullptr;
|
||||
|
||||
if( footprint )
|
||||
{
|
||||
FOOTPRINT* copy = (FOOTPRINT*) footprint->Duplicate();
|
||||
copy->SetParent( nullptr );
|
||||
return copy;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2238,7 +2238,15 @@ FOOTPRINT* PCB_IO::FootprintLoad( const wxString& aLibraryPath, const wxString&
|
|||
const PROPERTIES* aProperties )
|
||||
{
|
||||
const FOOTPRINT* footprint = getFootprint( aLibraryPath, aFootprintName, aProperties, true );
|
||||
return footprint ? (FOOTPRINT*) footprint->Duplicate() : nullptr;
|
||||
|
||||
if( footprint )
|
||||
{
|
||||
FOOTPRINT* copy = (FOOTPRINT*) footprint->Duplicate();
|
||||
copy->SetParent( nullptr );
|
||||
return copy;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3325,7 +3325,9 @@ FOOTPRINT* LEGACY_PLUGIN::FootprintLoad( const wxString& aLibraryPath,
|
|||
}
|
||||
|
||||
// Return copy of already loaded FOOTPRINT
|
||||
return (FOOTPRINT*) it->second->Duplicate();
|
||||
FOOTPRINT* copy = (FOOTPRINT*) it->second->Duplicate();
|
||||
copy->SetParent( nullptr );
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue