More complete fix for crasher JP found.

Fixes https://gitlab.com/kicad/code/kicad/issues/7806
This commit is contained in:
Jeff Young 2021-03-05 15:30:12 +00:00
parent 68f958145d
commit 3e9eb3c8ac
2 changed files with 63 additions and 29 deletions

View File

@ -541,47 +541,21 @@ public:
/**
* @return the current diff pair track width, according to the selected options
* ( using the default netclass value or a preset/custom value )
* the default netclass is always in m_DiffPairDimensionsList[0].
*/
inline int GetCurrentDiffPairWidth() const
{
if( m_useCustomDiffPair )
return m_customDiffPair.m_Width;
else if( m_diffPairIndex < m_DiffPairDimensionsList.size() )
return m_DiffPairDimensionsList[m_diffPairIndex].m_Width;
else
return GetCurrentTrackWidth();
}
int GetCurrentDiffPairWidth() const;
/**
* @return the current diff pair gap, according to the selected options
* ( using the default netclass value or a preset/custom value )
* the default netclass is always in m_DiffPairDimensionsList[0].
*/
inline int GetCurrentDiffPairGap() const
{
if( m_useCustomDiffPair )
return m_customDiffPair.m_Gap;
else if( m_diffPairIndex < m_DiffPairDimensionsList.size() )
return m_DiffPairDimensionsList[m_diffPairIndex].m_Gap;
else
return GetSmallestClearanceValue();
}
int GetCurrentDiffPairGap() const;
/**
* @return the current diff pair via gap, according to the selected options
* ( using the default netclass value or a preset/custom value )
* the default netclass is always in m_DiffPairDimensionsList[0].
*/
inline int GetCurrentDiffPairViaGap() const
{
if( m_useCustomDiffPair )
return m_customDiffPair.m_ViaGap;
else if( m_diffPairIndex < m_DiffPairDimensionsList.size() )
return m_DiffPairDimensionsList[m_diffPairIndex].m_ViaGap;
else
return GetSmallestClearanceValue();
}
int GetCurrentDiffPairViaGap() const;
/**
* @param aValue The minimum distance between the edges of two holes or 0 to disable

View File

@ -974,6 +974,66 @@ void BOARD_DESIGN_SETTINGS::SetDiffPairIndex( unsigned aIndex )
}
int BOARD_DESIGN_SETTINGS::GetCurrentDiffPairWidth() const
{
if( m_useCustomDiffPair )
{
return m_customDiffPair.m_Width;
}
else if( m_diffPairIndex == 0 )
{
if( GetNetClasses().GetDefaultPtr()->HasDiffPairWidth() )
return GetNetClasses().GetDefaultPtr()->GetDiffPairWidth();
else
return GetNetClasses().GetDefaultPtr()->GetTrackWidth();
}
else
{
return m_DiffPairDimensionsList[m_diffPairIndex].m_Width;
}
}
int BOARD_DESIGN_SETTINGS::GetCurrentDiffPairGap() const
{
if( m_useCustomDiffPair )
{
return m_customDiffPair.m_Gap;
}
else if( m_diffPairIndex == 0 )
{
if( GetNetClasses().GetDefaultPtr()->HasDiffPairGap() )
return GetNetClasses().GetDefaultPtr()->GetDiffPairGap();
else
return GetNetClasses().GetDefaultPtr()->GetClearance();
}
else
{
return m_DiffPairDimensionsList[m_diffPairIndex].m_Gap;
}
}
int BOARD_DESIGN_SETTINGS::GetCurrentDiffPairViaGap() const
{
if( m_useCustomDiffPair )
{
return m_customDiffPair.m_ViaGap;
}
else if( m_diffPairIndex == 0 )
{
if( GetNetClasses().GetDefaultPtr()->HasDiffPairViaGap() )
return GetNetClasses().GetDefaultPtr()->GetDiffPairViaGap();
else
return GetCurrentDiffPairGap();
}
else
{
return m_DiffPairDimensionsList[m_diffPairIndex].m_ViaGap;
}
}
void BOARD_DESIGN_SETTINGS::SetMinHoleSeparation( int aDistance )
{
m_HoleToHoleMin = aDistance;