pcbnew: intermittent fix for crash on save after undoing board update.
This commit is contained in:
parent
f3c6e1fb62
commit
f16f0fc215
|
@ -3020,3 +3020,38 @@ void BOARD::ClearAllNetCodes()
|
||||||
for( auto track : Tracks() )
|
for( auto track : Tracks() )
|
||||||
track->SetNetCode( 0 );
|
track->SetNetCode( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::vector<BOARD_CONNECTED_ITEM*> BOARD::AllConnectedItems()
|
||||||
|
{
|
||||||
|
std::vector<BOARD_CONNECTED_ITEM*> items;
|
||||||
|
|
||||||
|
for( auto track : Tracks() )
|
||||||
|
{
|
||||||
|
items.push_back( track );
|
||||||
|
}
|
||||||
|
|
||||||
|
for( auto mod : Modules() )
|
||||||
|
{
|
||||||
|
for( auto pad : mod->Pads() )
|
||||||
|
{
|
||||||
|
items.push_back( pad );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for( int i = 0; i<GetAreaCount(); i++ )
|
||||||
|
{
|
||||||
|
auto zone = GetArea( i );
|
||||||
|
items.push_back( zone );
|
||||||
|
}
|
||||||
|
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BOARD::SanitizeNetcodes()
|
||||||
|
{
|
||||||
|
for ( auto item : AllConnectedItems() )
|
||||||
|
{
|
||||||
|
if( FindNet( item->GetNetCode() ) == nullptr )
|
||||||
|
item->SetNetCode( NETINFO_LIST::ORPHANED );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -254,7 +254,7 @@ public:
|
||||||
DLIST_ITERATOR_WRAPPER<MODULE> Modules() { return DLIST_ITERATOR_WRAPPER<MODULE>(m_Modules); }
|
DLIST_ITERATOR_WRAPPER<MODULE> Modules() { return DLIST_ITERATOR_WRAPPER<MODULE>(m_Modules); }
|
||||||
DLIST_ITERATOR_WRAPPER<BOARD_ITEM> Drawings() { return DLIST_ITERATOR_WRAPPER<BOARD_ITEM>(m_Drawings); }
|
DLIST_ITERATOR_WRAPPER<BOARD_ITEM> Drawings() { return DLIST_ITERATOR_WRAPPER<BOARD_ITEM>(m_Drawings); }
|
||||||
ZONE_CONTAINERS& Zones() { return m_ZoneDescriptorList; }
|
ZONE_CONTAINERS& Zones() { return m_ZoneDescriptorList; }
|
||||||
|
const std::vector<BOARD_CONNECTED_ITEM*> AllConnectedItems();
|
||||||
|
|
||||||
// will be deprecated as soon as append board functionality is fixed
|
// will be deprecated as soon as append board functionality is fixed
|
||||||
DLIST<BOARD_ITEM>& DrawingsList() { return m_Drawings; }
|
DLIST<BOARD_ITEM>& DrawingsList() { return m_Drawings; }
|
||||||
|
@ -1358,6 +1358,8 @@ public:
|
||||||
* Resets all items' netcodes to 0 (no net).
|
* Resets all items' netcodes to 0 (no net).
|
||||||
*/
|
*/
|
||||||
void ClearAllNetCodes();
|
void ClearAllNetCodes();
|
||||||
|
|
||||||
|
void SanitizeNetcodes();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLASS_BOARD_H_
|
#endif // CLASS_BOARD_H_
|
||||||
|
|
|
@ -588,6 +588,8 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
|
||||||
{
|
{
|
||||||
Compile_Ratsnest( NULL, false );
|
Compile_Ratsnest( NULL, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GetBoard()->SanitizeNetcodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue