From c8b2971d1c8fb84d9f83c12087c78be668b77356 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Fri, 19 Feb 2016 17:13:32 -0500 Subject: [PATCH] Fix bug in component library editor. (fixes lp:1547299) * Use temporary storage of new pins to prevent corruption of the library part draw items list when adding alternater body style pins to existing component which caused segfault. --- eeschema/class_libentry.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index 7941d8e511..cb99d68687 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -1672,6 +1672,8 @@ void LIB_PART::SetConversion( bool aSetConvert ) // Duplicate items to create the converted shape if( aSetConvert ) { + std::vector< LIB_ITEM* > tmp; // Temporarily store the duplicated pins here. + BOOST_FOREACH( LIB_ITEM& item, drawings ) { // Only pins are duplicated. @@ -1682,9 +1684,13 @@ void LIB_PART::SetConversion( bool aSetConvert ) { LIB_ITEM* newItem = (LIB_ITEM*) item.Clone(); newItem->m_Convert = 2; - drawings.push_back( newItem ); + tmp.push_back( newItem ); } } + + // Transfer the new pins to the LIB_PART. + for( unsigned i = 0; i < tmp.size(); i++ ) + drawings.push_back( tmp[i] ); } else {