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 377ffb00b0)
This commit is contained in:
Jeff Young 2023-08-31 23:28:02 +01:00
parent 5c5e41500a
commit 351cb7e104
2 changed files with 5 additions and 0 deletions

View File

@ -702,6 +702,10 @@ int DIALOG_CHANGE_SYMBOLS::processSymbols( const std::map<SCH_SYMBOL*,
symbol->SetSchSymbolLibraryName( wxEmptyString ); symbol->SetSchSymbolLibraryName( wxEmptyString );
screen->Append( symbol ); screen->Append( symbol );
if( resetPositions )
symbol->AutoAutoplaceFields( screen );
frame->GetCanvas()->GetView()->Update( symbol ); frame->GetCanvas()->GetView()->Update( symbol );
msg = getSymbolReferences( *symbol, symbol_change_info.m_LibId ); msg = getSymbolReferences( *symbol, symbol_change_info.m_LibId );

View File

@ -592,6 +592,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnDeleteField( wxCommandEvent& event )
} }
m_grid->CommitPendingChanges( true /* quiet mode */ ); m_grid->CommitPendingChanges( true /* quiet mode */ );
m_grid->ClearSelection();
// Reverse sort so deleting a row doesn't change the indexes of the other rows. // Reverse sort so deleting a row doesn't change the indexes of the other rows.
selectedRows.Sort( []( int* first, int* second ) { return *second - *first; } ); selectedRows.Sort( []( int* first, int* second ) { return *second - *first; } );