From 585f11a01d30ab92f8288fb7942c3bc1bed2d8b9 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sat, 18 May 2024 22:16:28 +0000 Subject: [PATCH] Clear undo/redo lists when removing board layers Fixes https://gitlab.com/kicad/code/kicad/-/issues/17613 (cherry picked from commit 90ee5e097a14f50a86b3c703ba12a0df53556fbc) Co-authored-by: Jon Evans --- pcbnew/dialogs/panel_setup_layers.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pcbnew/dialogs/panel_setup_layers.cpp b/pcbnew/dialogs/panel_setup_layers.cpp index 3c9e671706..cb08ee15d6 100644 --- a/pcbnew/dialogs/panel_setup_layers.cpp +++ b/pcbnew/dialogs/panel_setup_layers.cpp @@ -505,11 +505,11 @@ bool PANEL_SETUP_LAYERS::TransferDataFromWindow() BOARD_ITEM* item = collector[i]; // Do not remove/change an item owned by a footprint - if( dynamic_cast( item->GetParentFootprint() ) ) + if( item->GetParentFootprint() ) continue; // Do not remove footprints - if( dynamic_cast( item ) ) + if( item->Type() == PCB_FOOTPRINT_T ) continue; LSET layers = item->GetLayerSet(); @@ -529,6 +529,9 @@ bool PANEL_SETUP_LAYERS::TransferDataFromWindow() } } } + + // Undo state may have copies of pointers deleted above + m_frame->ClearUndoRedoList(); } m_enabledLayers = GetUILayerMask();