From d3a60f7d83b0094c8d41a801335c33d61346c471 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Wed, 23 Mar 2022 11:46:49 -0400 Subject: [PATCH] Fix broken symbol field table editor dialog. Do not use the symbol field string to populate the value and footprint grid cells. The field strings may be empty because the symbol has not been instantiated yet by entering a sheet. This fix makes an incorrect assumption that the first instance value and footprint data in the symbol is the same for all instances. Note: this fix is incomplete because the value and footprint fields are can now be different between sheet instances. The entire field table editor design will need to be rethought because the current grouping doesn't allow different value and footprint instance changes. Fixes https://gitlab.com/kicad/code/kicad/-/issues/11194 (cherry picked from commit b87fc45e33b050b226803038872b4bde271df0d0) --- eeschema/dialogs/dialog_symbol_fields_table.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/eeschema/dialogs/dialog_symbol_fields_table.cpp b/eeschema/dialogs/dialog_symbol_fields_table.cpp index 5ed991db34..22b4c28c2c 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table.cpp +++ b/eeschema/dialogs/dialog_symbol_fields_table.cpp @@ -208,8 +208,17 @@ public: for( unsigned i = 0; i < m_symbolsList.GetCount(); ++i ) { SCH_SYMBOL* symbol = m_symbolsList[ i ].GetSymbol(); - m_dataStore[ symbol->m_Uuid ][ aFieldName ] = symbol->GetFieldText( aFieldName, - m_frame ); + + wxCHECK( symbol && ( symbol->GetInstanceReferences().size() != 0 ), /* void */ ); + + wxString val = symbol->GetFieldText( aFieldName, m_frame ); + + if( aFieldName == wxT( "Value" ) ) + val = symbol->GetInstanceReferences()[0].m_Value; + else if( aFieldName == wxT( "Footprint" ) ) + val = symbol->GetInstanceReferences()[0].m_Footprint; + + m_dataStore[ symbol->m_Uuid ][ aFieldName ] = val; } }