Fix crash on custom shape pad primitive duplication

Fixes: lp:1750463
* https://bugs.launchpad.net/kicad/+bug/1750463
This commit is contained in:
Maciej Suminski 2018-02-20 12:59:39 +01:00
parent be871c0f8c
commit ee6ac1af1d
1 changed files with 6 additions and 2 deletions

View File

@ -2036,8 +2036,12 @@ void DIALOG_PAD_PROPERTIES::onDuplicatePrimitive( wxCommandEvent& event )
if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK )
return; return;
// Transfert new settings: // Transfer new settings
dlg.Transform( &m_primitives, dlg.GetDuplicateCount() ); // save duplicates to a separate vector to avoid m_primitives reallocation,
// as shapeList contains pointers to its elements
std::vector<PAD_CS_PRIMITIVE> duplicates;
dlg.Transform( &duplicates, dlg.GetDuplicateCount() );
std::move( duplicates.begin(), duplicates.end(), std::back_inserter( m_primitives ) );
displayPrimitivesList(); displayPrimitivesList();