From 323a069738d1568f95392ffa15ad0e6b41c2d91c Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 20 Jan 2022 11:27:15 -0800 Subject: [PATCH] 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 --- eeschema/dialogs/dialog_sheet_properties.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eeschema/dialogs/dialog_sheet_properties.cpp b/eeschema/dialogs/dialog_sheet_properties.cpp index 72e96f4319..7642f10e09 100644 --- a/eeschema/dialogs/dialog_sheet_properties.cpp +++ b/eeschema/dialogs/dialog_sheet_properties.cpp @@ -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 ) {