From 377ffb00b080e7b862e3aa77976ed6db76b24513 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 --- 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 9a3a9a9e8a..cc22929a91 100644 --- a/eeschema/dialogs/dialog_change_symbols.cpp +++ b/eeschema/dialogs/dialog_change_symbols.cpp @@ -705,6 +705,10 @@ int DIALOG_CHANGE_SYMBOLS::processSymbols( SCH_COMMIT* aCommit, symbol->SetSchSymbolLibraryName( 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 9cfc9a8ca8..0b60b0960c 100644 --- a/eeschema/dialogs/dialog_lib_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_lib_symbol_properties.cpp @@ -543,6 +543,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; } );