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
(cherry picked from commit 8753051db6
)
This commit is contained in:
parent
849e979307
commit
16e802aff4
|
@ -211,6 +211,8 @@ void RC_TREE_MODEL::rebuildModel( RC_ITEMS_PROVIDER* aProvider, int aSeverities
|
||||||
m_view->UnselectAll();
|
m_view->UnselectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BeforeReset();
|
||||||
|
|
||||||
if( aProvider != m_rcItemsProvider )
|
if( aProvider != m_rcItemsProvider )
|
||||||
{
|
{
|
||||||
delete m_rcItemsProvider;
|
delete m_rcItemsProvider;
|
||||||
|
@ -256,7 +258,7 @@ void RC_TREE_MODEL::rebuildModel( RC_ITEMS_PROVIDER* aProvider, int aSeverities
|
||||||
|
|
||||||
// Must be called after a significant change of items to force the
|
// Must be called after a significant change of items to force the
|
||||||
// wxDataViewModel to reread all of them, repopulating itself entirely.
|
// wxDataViewModel to reread all of them, repopulating itself entirely.
|
||||||
Cleared();
|
AfterReset();
|
||||||
|
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
// The fastest method to update wxDataViewCtrl is to rebuild from
|
// 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(),
|
rtree.QueryColliding( track, track->GetLayer(), track->GetLayer(),
|
||||||
// Filter:
|
// Filter:
|
||||||
|
@ -362,7 +362,8 @@ void TRACKS_CLEANER::cleanup( bool aDeleteDuplicateVias, bool aDeleteNullSegment
|
||||||
{
|
{
|
||||||
return aItem->Type() == PCB_TRACE_T
|
return aItem->Type() == PCB_TRACE_T
|
||||||
&& !aItem->HasFlag( SKIP_STRUCT )
|
&& !aItem->HasFlag( SKIP_STRUCT )
|
||||||
&& !aItem->HasFlag( IS_DELETED );
|
&& !aItem->HasFlag( IS_DELETED )
|
||||||
|
&& !static_cast<PCB_TRACK*>( aItem )->IsNull();
|
||||||
},
|
},
|
||||||
// Visitor:
|
// Visitor:
|
||||||
[&]( BOARD_ITEM* aItem ) -> bool
|
[&]( BOARD_ITEM* aItem ) -> bool
|
||||||
|
|
Loading…
Reference in New Issue