diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp index cf7c2e5686..06dc190733 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp @@ -511,7 +511,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers() { D( printf( "add template:%s\n", TO_UTF8( it->m_Name ) ); ) - fld.SetName( it->m_Name ); + fld.SetName( it->m_Name ); fld.m_Text = it->m_Value; // empty? ok too. if( !it->m_Visible ) diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index ef1bf5d20c..fdaacaf2f9 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -710,6 +710,8 @@ void SCH_EDIT_FRAME::SaveSettings() m_TemplateFieldNames.Format( &sf, 0 ); + D(printf("saving formatted template fieldnames:'%s'\n", sf.GetString().c_str() );) + wxString record = FROM_UTF8( sf.GetString().c_str() ); record.Replace( wxT("\n"), wxT(""), true ); // strip all newlines record.Replace( wxT(" "), wxT(" "), true ); // double space to single diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index 4559fe7b76..8c5faf867a 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -631,8 +631,12 @@ void LIB_FIELD::SetName( const wxString& aName ) // Mandatory field names are fixed. // So what? Why should the low level code be in charge of such a policy issue? - if( m_id < MANDATORY_FIELDS ) + // Besides, m_id is a relic that is untrustworthy now. + if( m_id >=0 && m_id < MANDATORY_FIELDS ) + { + D(printf( "trying to set a MANDATORY_FIELD's name\n" );) return; + } if( m_name != aName ) {