Clear flags after we're done with them

The CANDIDATE flag is a temporary element that should not be maintained
outside of the routine in which is it temporarily set

Fixes https://gitlab.com/kicad/code/kicad/issues/11361
This commit is contained in:
Seth Hillbrand 2022-04-16 15:44:34 -07:00
parent 65f7d9f97a
commit 250a246761
1 changed files with 5 additions and 0 deletions

View File

@ -1240,6 +1240,7 @@ bool EE_SELECTION_TOOL::selectMultiple()
// Build lists of nearby items and their children // Build lists of nearby items and their children
std::vector<EDA_ITEM*> nearbyItems; std::vector<EDA_ITEM*> nearbyItems;
std::vector<EDA_ITEM*> nearbyChildren; std::vector<EDA_ITEM*> nearbyChildren;
std::vector<EDA_ITEM*> flaggedItems;
for( KIGFX::VIEW::LAYER_ITEM_PAIR& pair : nearbyViewItems ) for( KIGFX::VIEW::LAYER_ITEM_PAIR& pair : nearbyViewItems )
{ {
@ -1313,6 +1314,7 @@ bool EE_SELECTION_TOOL::selectMultiple()
if( Selectable( item ) && item->HitTest( selectionRect, isWindowSelection ) ) if( Selectable( item ) && item->HitTest( selectionRect, isWindowSelection ) )
{ {
item->SetFlags( CANDIDATE ); item->SetFlags( CANDIDATE );
flaggedItems.push_back( item );
selectItem( item ); selectItem( item );
} }
} }
@ -1327,6 +1329,9 @@ bool EE_SELECTION_TOOL::selectMultiple()
} }
} }
for( EDA_ITEM* item : flaggedItems )
item->ClearFlags( CANDIDATE );
m_selection.SetIsHover( false ); m_selection.SetIsHover( false );
// Inform other potentially interested tools // Inform other potentially interested tools