Avoid updating max clearance while in dtor
Max clearance is updated by IncrementTimeStamp(), which is called when in the FOOTPRINT dtor and ZONE dtor. This can cause issues when iterating over all footprints as the footprints may be delete-ed Fixes https://gitlab.com/kicad/code/kicad/issues/17269
This commit is contained in:
parent
8b3fc41ee5
commit
7520a8b316
|
@ -80,7 +80,7 @@ BOARD::BOARD() :
|
|||
m_project( nullptr ),
|
||||
m_userUnits( EDA_UNITS::MILLIMETRES ),
|
||||
m_designSettings( new BOARD_DESIGN_SETTINGS( nullptr, "board.design_settings" ) ),
|
||||
m_deleting( false ),
|
||||
m_skipMaxClearanceCacheUpdate( false ),
|
||||
m_maxClearanceValue( 0 ),
|
||||
m_NetInfo( this )
|
||||
{
|
||||
|
@ -133,7 +133,7 @@ BOARD::BOARD() :
|
|||
|
||||
BOARD::~BOARD()
|
||||
{
|
||||
m_deleting = true;
|
||||
m_skipMaxClearanceCacheUpdate = true;
|
||||
|
||||
// Untangle group parents before doing any deleting
|
||||
for( PCB_GROUP* group : m_groups )
|
||||
|
@ -780,8 +780,8 @@ BOARD_DESIGN_SETTINGS& BOARD::GetDesignSettings() const
|
|||
|
||||
void BOARD::UpdateMaxClearanceCache()
|
||||
{
|
||||
// in destructor, useless work
|
||||
if( m_deleting )
|
||||
// in destructor or otherwise reasonable to skip
|
||||
if( m_skipMaxClearanceCacheUpdate )
|
||||
return;
|
||||
|
||||
int worstClearance = m_designSettings->GetBiggestClearanceValue();
|
||||
|
@ -1121,10 +1121,14 @@ void BOARD::DeleteMARKERs( bool aWarningsAndErrors, bool aExclusions )
|
|||
|
||||
void BOARD::DeleteAllFootprints()
|
||||
{
|
||||
m_skipMaxClearanceCacheUpdate = true;
|
||||
|
||||
for( FOOTPRINT* footprint : m_footprints )
|
||||
delete footprint;
|
||||
|
||||
m_footprints.clear();
|
||||
m_skipMaxClearanceCacheUpdate = false;
|
||||
UpdateMaxClearanceCache();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1320,7 +1320,7 @@ private:
|
|||
*/
|
||||
bool m_legacyTeardrops = false;
|
||||
|
||||
bool m_deleting; // inside destructor
|
||||
bool m_skipMaxClearanceCacheUpdate;
|
||||
int m_maxClearanceValue; // cached value
|
||||
|
||||
NETINFO_LIST m_NetInfo; // net info list (name, design constraints...
|
||||
|
|
Loading…
Reference in New Issue