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() )
|
||||
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<BOARD_ITEM> Drawings() { return DLIST_ITERATOR_WRAPPER<BOARD_ITEM>(m_Drawings); }
|
||||
ZONE_CONTAINERS& Zones() { return m_ZoneDescriptorList; }
|
||||
|
||||
const std::vector<BOARD_CONNECTED_ITEM*> AllConnectedItems();
|
||||
|
||||
// will be deprecated as soon as append board functionality is fixed
|
||||
DLIST<BOARD_ITEM>& DrawingsList() { return m_Drawings; }
|
||||
|
@ -1358,6 +1358,8 @@ public:
|
|||
* Resets all items' netcodes to 0 (no net).
|
||||
*/
|
||||
void ClearAllNetCodes();
|
||||
|
||||
void SanitizeNetcodes();
|
||||
};
|
||||
|
||||
#endif // CLASS_BOARD_H_
|
||||
|
|
|
@ -581,13 +581,15 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
|
|||
|
||||
if( not_found )
|
||||
wxMessageBox( wxT( "Incomplete undo/redo operation: some items not found" ) );
|
||||
|
||||
|
||||
// Rebuild pointers and connectivity that can be changed.
|
||||
// connectivity can be rebuilt only in the board editor frame
|
||||
if( IsType( FRAME_PCB ) && ( reBuild_ratsnest || deep_reBuild_ratsnest ) )
|
||||
{
|
||||
Compile_Ratsnest( NULL, false );
|
||||
}
|
||||
|
||||
GetBoard()->SanitizeNetcodes();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue