Don't double-delete unused nets (or anything else, for that matter).
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15979
This commit is contained in:
parent
3d5721a217
commit
e7fca68384
|
@ -61,6 +61,9 @@ COMMIT& COMMIT::Stage( EDA_ITEM* aItem, CHANGE_TYPE aChangeType, BASE_SCREEN* aS
|
|||
return *this;
|
||||
|
||||
case CHT_REMOVE:
|
||||
wxASSERT_MSG( m_deletedItems.find( aItem ) == m_deletedItems.end(),
|
||||
wxT( "Item already staged for deletion" ) );
|
||||
m_deletedItems.insert( aItem );
|
||||
makeEntry( aItem, CHT_REMOVE | flag, nullptr, aScreen );
|
||||
return *this;
|
||||
|
||||
|
@ -133,9 +136,8 @@ int COMMIT::GetStatus( EDA_ITEM* aItem, BASE_SCREEN *aScreen )
|
|||
COMMIT& COMMIT::createModified( EDA_ITEM* aItem, EDA_ITEM* aCopy, int aExtraFlags, BASE_SCREEN* aScreen )
|
||||
{
|
||||
EDA_ITEM* parent = parentObject( aItem );
|
||||
auto entryIt = m_changedItems.find( parent );
|
||||
|
||||
if( entryIt != m_changedItems.end() )
|
||||
if( m_changedItems.find( parent ) != m_changedItems.end() )
|
||||
{
|
||||
delete aCopy;
|
||||
return *this; // item has been already modified once
|
||||
|
|
|
@ -163,6 +163,7 @@ protected:
|
|||
void clear()
|
||||
{
|
||||
m_changedItems.clear();
|
||||
m_deletedItems.clear();
|
||||
m_changes.clear();
|
||||
}
|
||||
|
||||
|
@ -188,6 +189,7 @@ protected:
|
|||
|
||||
protected:
|
||||
std::set<EDA_ITEM*> m_changedItems;
|
||||
std::set<EDA_ITEM*> m_deletedItems;
|
||||
std::vector<COMMIT_LINE> m_changes;
|
||||
};
|
||||
|
||||
|
|
|
@ -638,7 +638,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( FOOTPRINT* aFootprint
|
|||
// Create a copy only if the footprint has not been added during this update
|
||||
FOOTPRINT* copy = nullptr;
|
||||
|
||||
if( !m_commit.GetStatus( aFootprint ) )
|
||||
if( !m_isDryRun && !m_commit.GetStatus( aFootprint ) )
|
||||
{
|
||||
copy = static_cast<FOOTPRINT*>( aFootprint->Clone() );
|
||||
copy->SetParentGroup( nullptr );
|
||||
|
@ -650,9 +650,11 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( FOOTPRINT* aFootprint
|
|||
PADS pads = aFootprint->Pads();
|
||||
std::set<wxString> padNetnames;
|
||||
|
||||
std::sort( pads.begin(), pads.end(), []( PAD* a, PAD* b ) {
|
||||
return a->m_Uuid < b->m_Uuid;
|
||||
} );
|
||||
std::sort( pads.begin(), pads.end(),
|
||||
[]( PAD* a, PAD* b )
|
||||
{
|
||||
return a->m_Uuid < b->m_Uuid;
|
||||
} );
|
||||
|
||||
for( PAD* pad : pads )
|
||||
{
|
||||
|
@ -1273,7 +1275,6 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist )
|
|||
{
|
||||
msg.Printf( _( "Removed unused net %s." ), net->GetNetname() );
|
||||
m_reporter->Report( msg, RPT_SEVERITY_ACTION );
|
||||
m_commit.Removed( net );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue