When garbage collecting locally we also need to clear global references.
(cherry picked from commit d93bb464bf
)
This commit is contained in:
parent
643894c882
commit
395a966802
|
@ -226,6 +226,12 @@ void CN_CONNECTIVITY_ALGO::searchConnections()
|
|||
|
||||
m_itemList.RemoveInvalidItems( garbage );
|
||||
|
||||
if( m_isLocal )
|
||||
{
|
||||
for( CN_ITEM* item : m_globalConnectivity->m_itemList )
|
||||
item->RemoveInvalidRefs();
|
||||
}
|
||||
|
||||
for( CN_ITEM* item : garbage )
|
||||
delete item;
|
||||
|
||||
|
@ -542,9 +548,13 @@ void CN_CONNECTIVITY_ALGO::Build( BOARD* aBoard, PROGRESS_REPORTER* aReporter )
|
|||
}
|
||||
|
||||
|
||||
void CN_CONNECTIVITY_ALGO::LocalBuild( const std::vector<BOARD_ITEM*>& aItems )
|
||||
void CN_CONNECTIVITY_ALGO::LocalBuild( std::shared_ptr<CN_CONNECTIVITY_ALGO> aGlobalConnectivity,
|
||||
const std::vector<BOARD_ITEM*>& aLocalItems )
|
||||
{
|
||||
for( BOARD_ITEM* item : aItems )
|
||||
m_isLocal = true;
|
||||
m_globalConnectivity = aGlobalConnectivity;
|
||||
|
||||
for( BOARD_ITEM* item : aLocalItems )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
|
|
|
@ -154,8 +154,14 @@ public:
|
|||
std::list<CN_ITEM*> m_items;
|
||||
};
|
||||
|
||||
CN_CONNECTIVITY_ALGO() {}
|
||||
~CN_CONNECTIVITY_ALGO() { Clear(); }
|
||||
CN_CONNECTIVITY_ALGO() :
|
||||
m_isLocal( false )
|
||||
{}
|
||||
|
||||
~CN_CONNECTIVITY_ALGO()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
bool ItemExists( const BOARD_CONNECTED_ITEM* aItem ) const
|
||||
{
|
||||
|
@ -197,8 +203,9 @@ public:
|
|||
return m_dirtyNets.size();
|
||||
}
|
||||
|
||||
void Build( BOARD* aZoneLayer, PROGRESS_REPORTER* aReporter = nullptr );
|
||||
void LocalBuild( const std::vector<BOARD_ITEM*>& aItems );
|
||||
void Build( BOARD* aBoard, PROGRESS_REPORTER* aReporter = nullptr );
|
||||
void LocalBuild( std::shared_ptr<CN_CONNECTIVITY_ALGO> aGlobalConnectivity,
|
||||
const std::vector<BOARD_ITEM*>& aLocalItems );
|
||||
|
||||
void Clear();
|
||||
|
||||
|
@ -272,6 +279,9 @@ private:
|
|||
std::vector<std::shared_ptr<CN_CLUSTER>> m_ratsnestClusters;
|
||||
std::vector<bool> m_dirtyNets;
|
||||
|
||||
bool m_isLocal;
|
||||
std::shared_ptr<CN_CONNECTIVITY_ALGO> m_globalConnectivity;
|
||||
|
||||
PROGRESS_REPORTER* m_progressReporter = nullptr;
|
||||
};
|
||||
|
||||
|
|
|
@ -44,7 +44,8 @@
|
|||
#include <trigo.h>
|
||||
#include <drc/drc_rtree.h>
|
||||
|
||||
CONNECTIVITY_DATA::CONNECTIVITY_DATA()
|
||||
CONNECTIVITY_DATA::CONNECTIVITY_DATA() :
|
||||
m_skipRatsnestUpdate( false )
|
||||
{
|
||||
m_connAlgo.reset( new CN_CONNECTIVITY_ALGO );
|
||||
m_progressReporter = nullptr;
|
||||
|
@ -52,10 +53,12 @@ CONNECTIVITY_DATA::CONNECTIVITY_DATA()
|
|||
}
|
||||
|
||||
|
||||
CONNECTIVITY_DATA::CONNECTIVITY_DATA( const std::vector<BOARD_ITEM*>& aItems, bool aSkipRatsnest )
|
||||
: m_skipRatsnest( aSkipRatsnest )
|
||||
CONNECTIVITY_DATA::CONNECTIVITY_DATA( std::shared_ptr<CONNECTIVITY_DATA> aGlobalConnectivity,
|
||||
const std::vector<BOARD_ITEM*>& aLocalItems,
|
||||
bool aSkipRatsnestUpdate ) :
|
||||
m_skipRatsnestUpdate( aSkipRatsnestUpdate )
|
||||
{
|
||||
Build( aItems );
|
||||
Build( aGlobalConnectivity, aLocalItems );
|
||||
m_progressReporter = nullptr;
|
||||
m_fromToCache.reset( new FROM_TO_CACHE );
|
||||
}
|
||||
|
@ -140,7 +143,8 @@ bool CONNECTIVITY_DATA::Build( BOARD* aBoard, PROGRESS_REPORTER* aReporter )
|
|||
}
|
||||
|
||||
|
||||
void CONNECTIVITY_DATA::Build( const std::vector<BOARD_ITEM*>& aItems )
|
||||
void CONNECTIVITY_DATA::Build( std::shared_ptr<CONNECTIVITY_DATA>& aGlobalConnectivity,
|
||||
const std::vector<BOARD_ITEM*>& aLocalItems )
|
||||
{
|
||||
std::unique_lock<KISPINLOCK> lock( m_lock, std::try_to_lock );
|
||||
|
||||
|
@ -148,7 +152,7 @@ void CONNECTIVITY_DATA::Build( const std::vector<BOARD_ITEM*>& aItems )
|
|||
return;
|
||||
|
||||
m_connAlgo.reset( new CN_CONNECTIVITY_ALGO );
|
||||
m_connAlgo->LocalBuild( aItems );
|
||||
m_connAlgo->LocalBuild( aGlobalConnectivity->GetConnectivityAlgo(), aLocalItems );
|
||||
|
||||
internalRecalculateRatsnest();
|
||||
}
|
||||
|
@ -272,7 +276,7 @@ void CONNECTIVITY_DATA::internalRecalculateRatsnest( BOARD_COMMIT* aCommit )
|
|||
|
||||
m_connAlgo->ClearDirtyFlags();
|
||||
|
||||
if( !m_skipRatsnest )
|
||||
if( !m_skipRatsnestUpdate )
|
||||
updateRatsnest();
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,8 @@ public:
|
|||
CONNECTIVITY_DATA();
|
||||
~CONNECTIVITY_DATA();
|
||||
|
||||
CONNECTIVITY_DATA( const std::vector<BOARD_ITEM*>& aItems, bool aSkipItems = false );
|
||||
CONNECTIVITY_DATA( std::shared_ptr<CONNECTIVITY_DATA> aGlobalConnectivity,
|
||||
const std::vector<BOARD_ITEM*>& aLocalItems, bool aSkipRatsnestUpdate = false );
|
||||
|
||||
/**
|
||||
* Function Build()
|
||||
|
@ -100,7 +101,8 @@ public:
|
|||
* Function Build()
|
||||
* Builds the connectivity database for a set of items aItems.
|
||||
*/
|
||||
void Build( const std::vector<BOARD_ITEM*>& aItems );
|
||||
void Build( std::shared_ptr<CONNECTIVITY_DATA>& aGlobalConnectivity,
|
||||
const std::vector<BOARD_ITEM*>& aLocalItems );
|
||||
|
||||
/**
|
||||
* Function Add()
|
||||
|
@ -297,7 +299,7 @@ private:
|
|||
std::vector<RN_NET*> m_nets;
|
||||
|
||||
/// Used to suppress ratsnest calculations on dynamic ratsnests
|
||||
bool m_skipRatsnest = false;
|
||||
bool m_skipRatsnestUpdate;
|
||||
|
||||
KISPINLOCK m_lock;
|
||||
|
||||
|
|
|
@ -2099,7 +2099,8 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
|
|||
courtyardClearanceDRC.m_FpInMove.push_back( footprint );
|
||||
}
|
||||
|
||||
dynamicData = std::make_unique<CONNECTIVITY_DATA>( dynamicItems, true );
|
||||
dynamicData = std::make_unique<CONNECTIVITY_DATA>( board()->GetConnectivity(),
|
||||
dynamicItems, true );
|
||||
connectivityData->BlockRatsnestItems( dynamicItems );
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1724,7 +1724,7 @@ void BOARD_INSPECTION_TOOL::calculateSelectionRatsnest( const VECTOR2I& aDelta )
|
|||
|
||||
if( !m_dynamicData )
|
||||
{
|
||||
m_dynamicData = new CONNECTIVITY_DATA( items, true );
|
||||
m_dynamicData = new CONNECTIVITY_DATA( board()->GetConnectivity(), items, true );
|
||||
connectivity->BlockRatsnestItems( items );
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue