Re-allocating a std::vector invalidates its iterators.
When we add enough SHEET_PINs that the vector has to grow, it re-allocates the vector causing our for-loop to get its knickers tied in a knot. Fixes: lp:1842394 * https://bugs.launchpad.net/kicad/+bug/1842394
This commit is contained in:
parent
c8a6878eb8
commit
3996a490a1
|
@ -690,6 +690,7 @@ bool EE_SELECTION_TOOL::selectMultiple()
|
|||
|
||||
// Mark items within the selection box as selected
|
||||
std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> selectedItems;
|
||||
std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> sheetPins;
|
||||
|
||||
// Filter the view items based on the selection box
|
||||
BOX2I selectionBox = area.ViewBBox();
|
||||
|
@ -705,10 +706,12 @@ bool EE_SELECTION_TOOL::selectMultiple()
|
|||
int layer = pair.second;
|
||||
|
||||
for( SCH_SHEET_PIN& pin : sheet->GetPins() )
|
||||
selectedItems.emplace_back( &pin, layer );
|
||||
sheetPins.emplace_back( KIGFX::VIEW::LAYER_ITEM_PAIR( &pin, layer ) );
|
||||
}
|
||||
}
|
||||
|
||||
selectedItems.insert( selectedItems.end(), sheetPins.begin(), sheetPins.end() );
|
||||
|
||||
int width = area.GetEnd().x - area.GetOrigin().x;
|
||||
int height = area.GetEnd().y - area.GetOrigin().y;
|
||||
|
||||
|
|
Loading…
Reference in New Issue