From ee6ac1af1dfbd44bdec0923f5d2b7ee0df243744 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Tue, 20 Feb 2018 12:59:39 +0100 Subject: [PATCH] Fix crash on custom shape pad primitive duplication Fixes: lp:1750463 * https://bugs.launchpad.net/kicad/+bug/1750463 --- pcbnew/dialogs/dialog_pad_properties.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index fd238e2937..2814ddc6bf 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -2036,8 +2036,12 @@ void DIALOG_PAD_PROPERTIES::onDuplicatePrimitive( wxCommandEvent& event ) if( dlg.ShowModal() != wxID_OK ) return; - // Transfert new settings: - dlg.Transform( &m_primitives, dlg.GetDuplicateCount() ); + // Transfer new settings + // save duplicates to a separate vector to avoid m_primitives reallocation, + // as shapeList contains pointers to its elements + std::vector duplicates; + dlg.Transform( &duplicates, dlg.GetDuplicateCount() ); + std::move( duplicates.begin(), duplicates.end(), std::back_inserter( m_primitives ) ); displayPrimitivesList();