Scan all items when looking for the weak reference.
... not just those directly in the draw list. Fixes: lp:1747037 * https://bugs.launchpad.net/kicad/+bug/1747037
This commit is contained in:
parent
84151990cd
commit
5ef715f3d3
|
@ -375,18 +375,27 @@ SCH_ITEM* SCH_FIND_COLLECTOR::GetItem( int ndx ) const
|
||||||
// treat it as a weak reference and search the sheets for an item with the same
|
// treat it as a weak reference and search the sheets for an item with the same
|
||||||
// pointer value.
|
// pointer value.
|
||||||
|
|
||||||
void* weakRef = m_List[ ndx ];
|
void* weakRef = m_List[ ndx ];
|
||||||
|
SCH_ITEM* item = &g_DeletedSchItem;
|
||||||
|
|
||||||
|
INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* candidate, void* testData )
|
||||||
|
{
|
||||||
|
if( (void*) candidate == weakRef )
|
||||||
|
{
|
||||||
|
item = (SCH_ITEM*) candidate;
|
||||||
|
return SEARCH_QUIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SEARCH_CONTINUE;
|
||||||
|
};
|
||||||
|
|
||||||
for( unsigned i = 0; i < m_sheetPaths.size(); i++ )
|
for( unsigned i = 0; i < m_sheetPaths.size(); i++ )
|
||||||
{
|
{
|
||||||
for( EDA_ITEM* item = m_sheetPaths[ i ].LastDrawList(); item; item = item->Next() )
|
EDA_ITEM::IterateForward( m_sheetPaths[ i ].LastDrawList(),
|
||||||
{
|
inspector, nullptr, SCH_COLLECTOR::AllItems );
|
||||||
if( (void*) item == weakRef )
|
|
||||||
return (SCH_ITEM*) item;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return &g_DeletedSchItem;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue