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

View File

@ -705,6 +705,10 @@ int DIALOG_CHANGE_SYMBOLS::processSymbols( SCH_COMMIT* aCommit,
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

@ -543,6 +543,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; } );