Don't count zero-length as duplicate
We were checking for duplicate tracks by looking to see if the two tracks had two shared points. A null track always matched this case, which removed the valid track. We solve this by avoiding null tracks in the duplicate checker. They are removed separately in the null track stage. This also fixes a GTK-specific tree issue where we require the BeforeReset()/AfterReset() calls instead of Cleared() to prevent GTK from dereferencing a parent after freeing Fixes https://gitlab.com/kicad/code/kicad/issues/10624
This commit is contained in:
parent
8ae304dcca
commit
8753051db6
|
@ -210,6 +210,8 @@ void RC_TREE_MODEL::rebuildModel( RC_ITEMS_PROVIDER* aProvider, int aSeverities
|
|||
m_view->UnselectAll();
|
||||
}
|
||||
|
||||
BeforeReset();
|
||||
|
||||
if( aProvider != m_rcItemsProvider )
|
||||
{
|
||||
delete m_rcItemsProvider;
|
||||
|
@ -255,7 +257,7 @@ void RC_TREE_MODEL::rebuildModel( RC_ITEMS_PROVIDER* aProvider, int aSeverities
|
|||
|
||||
// Must be called after a significant change of items to force the
|
||||
// wxDataViewModel to reread all of them, repopulating itself entirely.
|
||||
Cleared();
|
||||
AfterReset();
|
||||
|
||||
#ifdef __WXGTK__
|
||||
// The fastest method to update wxDataViewCtrl is to rebuild from
|
||||
|
|
|
@ -354,7 +354,7 @@ void TRACKS_CLEANER::cleanup( bool aDeleteDuplicateVias, bool aDeleteNullSegment
|
|||
}
|
||||
}
|
||||
|
||||
if( aDeleteDuplicateSegments && track->Type() == PCB_TRACE_T )
|
||||
if( aDeleteDuplicateSegments && track->Type() == PCB_TRACE_T && !track->IsNull() )
|
||||
{
|
||||
rtree.QueryColliding( track, track->GetLayer(), track->GetLayer(),
|
||||
// Filter:
|
||||
|
@ -362,7 +362,8 @@ void TRACKS_CLEANER::cleanup( bool aDeleteDuplicateVias, bool aDeleteNullSegment
|
|||
{
|
||||
return aItem->Type() == PCB_TRACE_T
|
||||
&& !aItem->HasFlag( SKIP_STRUCT )
|
||||
&& !aItem->HasFlag( IS_DELETED );
|
||||
&& !aItem->HasFlag( IS_DELETED )
|
||||
&& !static_cast<PCB_TRACK*>( aItem )->IsNull();
|
||||
},
|
||||
// Visitor:
|
||||
[&]( BOARD_ITEM* aItem ) -> bool
|
||||
|
|
Loading…
Reference in New Issue