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
|
@ -155,14 +155,11 @@ FOOTPRINT::FOOTPRINT( const FOOTPRINT& aFootprint ) :
|
||||||
m_3D_Drawings = aFootprint.m_3D_Drawings;
|
m_3D_Drawings = aFootprint.m_3D_Drawings;
|
||||||
|
|
||||||
m_doc = aFootprint.m_doc;
|
m_doc = aFootprint.m_doc;
|
||||||
m_keywords = aFootprint.m_keywords;
|
m_keywords = aFootprint.m_keywords;
|
||||||
m_properties = aFootprint.m_properties;
|
m_properties = aFootprint.m_properties;
|
||||||
|
|
||||||
m_arflag = 0;
|
m_arflag = 0;
|
||||||
|
|
||||||
// Ensure auxiliary data is up to date
|
|
||||||
CalculateBoundingBox();
|
|
||||||
|
|
||||||
m_initial_comments = aFootprint.m_initial_comments ?
|
m_initial_comments = aFootprint.m_initial_comments ?
|
||||||
new wxArrayString( *aFootprint.m_initial_comments ) : nullptr;
|
new wxArrayString( *aFootprint.m_initial_comments ) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2847,7 +2847,9 @@ FOOTPRINT* EAGLE_PLUGIN::FootprintLoad( const wxString& aLibraryPath,
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// Return a copy of the template
|
// 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 PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
const FOOTPRINT* footprint = getFootprint( aLibraryPath, aFootprintName, aProperties, true );
|
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 PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
const FOOTPRINT* footprint = getFootprint( aLibraryPath, aFootprintName, aProperties, true );
|
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 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