From 351cb7e104522d4649e55f333d62317675e1255a Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 31 Aug 2023 23:28:02 +0100 Subject: [PATCH] Re-run autoplacement after symbol replacement (when appropriate). Also prevents an internal wxWidgets assert by clearing grid selection before deleting rows. Fixes https://gitlab.com/kicad/code/kicad/-/issues/15541 (cherry picked from commit 377ffb00b080e7b862e3aa77976ed6db76b24513) --- eeschema/dialogs/dialog_change_symbols.cpp | 4 ++++ eeschema/dialogs/dialog_lib_symbol_properties.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/eeschema/dialogs/dialog_change_symbols.cpp b/eeschema/dialogs/dialog_change_symbols.cpp index 7b6f7185d3..dc821191c8 100644 --- a/eeschema/dialogs/dialog_change_symbols.cpp +++ b/eeschema/dialogs/dialog_change_symbols.cpp @@ -702,6 +702,10 @@ int DIALOG_CHANGE_SYMBOLS::processSymbols( const std::mapSetSchSymbolLibraryName( wxEmptyString ); screen->Append( symbol ); + + if( resetPositions ) + symbol->AutoAutoplaceFields( screen ); + frame->GetCanvas()->GetView()->Update( symbol ); msg = getSymbolReferences( *symbol, symbol_change_info.m_LibId ); diff --git a/eeschema/dialogs/dialog_lib_symbol_properties.cpp b/eeschema/dialogs/dialog_lib_symbol_properties.cpp index 5d1f71c199..5814f874ff 100644 --- a/eeschema/dialogs/dialog_lib_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_lib_symbol_properties.cpp @@ -592,6 +592,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnDeleteField( wxCommandEvent& event ) } m_grid->CommitPendingChanges( true /* quiet mode */ ); + m_grid->ClearSelection(); // Reverse sort so deleting a row doesn't change the indexes of the other rows. selectedRows.Sort( []( int* first, int* second ) { return *second - *first; } );