mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 19:43:44 +00:00
Hold weak reference to NET_SETTINGS in CONNECTIVITY_DATA
This commit is contained in:
parent
3c799875d8
commit
03e388be80
pcbnew
connectivity
ratsnest
router
@ -1077,3 +1077,10 @@ const std::vector<CN_EDGE> CONNECTIVITY_DATA::GetRatsnestForComponent( FOOTPRINT
|
||||
}
|
||||
|
||||
|
||||
const NET_SETTINGS* CONNECTIVITY_DATA::GetNetSettings() const
|
||||
{
|
||||
if( std::shared_ptr<NET_SETTINGS> netSettings = m_netSettings.lock() )
|
||||
return netSettings.get();
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ public:
|
||||
|
||||
void SetProgressReporter( PROGRESS_REPORTER* aReporter );
|
||||
|
||||
const NET_SETTINGS* GetNetSettings() const { return m_netSettings.get(); }
|
||||
const NET_SETTINGS* GetNetSettings() const;
|
||||
|
||||
bool HasNetNameForNetCode( int nc ) const { return m_netcodeMap.count( nc ) > 0; }
|
||||
const wxString& GetNetNameForNetCode( int nc ) const { return m_netcodeMap.at( nc ); }
|
||||
@ -316,7 +316,7 @@ private:
|
||||
PROGRESS_REPORTER* m_progressReporter;
|
||||
|
||||
/// @brief Used to get netclass data when drawing ratsnests
|
||||
std::shared_ptr<NET_SETTINGS> m_netSettings;
|
||||
std::weak_ptr<NET_SETTINGS> m_netSettings;
|
||||
|
||||
/// @brief Used to map netcode to net name
|
||||
std::map<int, wxString> m_netcodeMap;
|
||||
|
@ -132,7 +132,7 @@ void RATSNEST_VIEW_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
||||
{
|
||||
const wxString& netName = m_data->GetNetNameForNetCode( l.netCode );
|
||||
|
||||
if( netSettings->HasEffectiveNetClass( netName ) )
|
||||
if( netSettings && netSettings->HasEffectiveNetClass( netName ) )
|
||||
nc = netSettings->GetCachedEffectiveNetClass( netName ).get();
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ void RATSNEST_VIEW_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
||||
{
|
||||
const wxString& netName = m_data->GetNetNameForNetCode( i );
|
||||
|
||||
if( netSettings->HasEffectiveNetClass( netName ) )
|
||||
if( netSettings && netSettings->HasEffectiveNetClass( netName ) )
|
||||
nc = netSettings->GetCachedEffectiveNetClass( netName ).get();
|
||||
}
|
||||
|
||||
|
@ -1749,7 +1749,7 @@ void PNS_KICAD_IFACE::DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, PNS::NET
|
||||
{
|
||||
const wxString& netName = connectivity->GetNetNameForNetCode( netCode );
|
||||
|
||||
if( netSettings->HasEffectiveNetClass( netName ) )
|
||||
if( netSettings && netSettings->HasEffectiveNetClass( netName ) )
|
||||
nc = netSettings->GetCachedEffectiveNetClass( netName ).get();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user