Pcbnew fix: checking properties on error marker crashed pcbnew

Fixes: lp:1674671
https://bugs.launchpad.net/kicad/+bug/1674671
This commit is contained in:
jean-pierre charras 2017-03-21 16:44:56 +01:00
parent c20cf4a3e0
commit 5bd61d7eb6
1 changed files with 6 additions and 1 deletions

View File

@ -339,13 +339,18 @@ SELECTION& SELECTION_TOOL::RequestSelection( int aFlags )
m_selection.SetIsHover( false );
}
for( auto item : m_selection )
// Be careful with iterators: items can be removed from list
// that invalidate iterators.
for( unsigned ii = 0; ii < m_selection.GetSize(); ii++ )
{
EDA_ITEM* item = m_selection[ii];
if( ( aFlags & SELECTION_EDITABLE ) && item->Type() == PCB_MARKER_T )
{
unselect( static_cast<BOARD_ITEM *>( item ) );
}
}
if ( aFlags & SELECTION_SANITIZE_PADS )
SanitizeSelection();