Clear Undo list when renaming

Our undo/redo list is tied to the screen that gets cleared when we
reload the file after renaming.  We need to clear the Undo list at this
point to prevent possible crashes when moving too far back in the stack

Fixes https://gitlab.com/kicad/code/kicad/issues/10504

(cherry picked from commit 323a069738)
This commit is contained in:
Seth Hillbrand 2022-01-20 11:27:15 -08:00
parent cffc99e384
commit 16aca901df
1 changed files with 3 additions and 0 deletions

View File

@ -544,8 +544,11 @@ bool DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged( const wxString& aNewFilena
}
}
// If we are renaming files, the undo/redo list becomes invalid and must be cleared
if( isUndoable )
m_frame->SaveCopyInUndoList( m_frame->GetScreen(), m_sheet, UNDO_REDO::CHANGED, false );
else
m_frame->ClearUndoRedoList();
if( renameFile )
{