From d3befd8bb8d27e1107009c002d3d26022fe77819 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Fri, 16 Feb 2024 11:26:28 +0000 Subject: [PATCH] Remove dummy items from group before they are deleted Board items should not be in a group when they are deleted, but these are dummy ones, so their group membership doesn't matter. Fixes KICAD-7P0 Fixes KICAD-6VX Fixes KICAD-7KK Fixes KICAD-6VH --- pcbnew/dialogs/dialog_pad_properties.cpp | 4 ++++ pcbnew/drc/drc_test_provider_library_parity.cpp | 1 + pcbnew/plot_board_layers.cpp | 2 ++ pcbnew/zone_filler.cpp | 6 ++++++ 4 files changed, 13 insertions(+) diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 81256d6dc2..664541639a 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -316,6 +316,10 @@ DIALOG_PAD_PROPERTIES::~DIALOG_PAD_PROPERTIES() m_page = m_notebook->GetSelection(); + // Remove the preview pad from the group of the actual pad before deletion + if( m_previewPad ) + m_previewPad->SetParentGroup( nullptr ); + delete m_previewPad; delete m_axisOrigin; } diff --git a/pcbnew/drc/drc_test_provider_library_parity.cpp b/pcbnew/drc/drc_test_provider_library_parity.cpp index dc87ab01ae..177c6385fc 100644 --- a/pcbnew/drc/drc_test_provider_library_parity.cpp +++ b/pcbnew/drc/drc_test_provider_library_parity.cpp @@ -638,6 +638,7 @@ bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFP, REPORTER* aReport // already normalized graphic items in model footprint from library, so we need to normalize // graphic items in the footprint to test (*this). So normalize them using a copy of this FOOTPRINT dummy( *this ); + dummy.SetParentGroup( nullptr ); dummy.SetParent( nullptr ); for( BOARD_ITEM* item : dummy.GraphicalItems() ) diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index a5fcd80d0f..5a6d57e8a3 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -526,6 +526,8 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, // inflate/deflate a custom shape is a bit complex. // so build a similar pad shape, and inflate/deflate the polygonal shape PAD dummy( *pad ); + dummy.SetParentGroup( nullptr ); + SHAPE_POLY_SET shape; pad->MergePrimitivesAsPolygon( &shape ); diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index 34a11ef75f..fdd00c6f7c 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -1944,6 +1944,9 @@ void ZONE_FILLER::buildThermalSpokes( const ZONE* aZone, PCB_LAYER_ID aLayer, spokeIter->Rotate( pad->GetOrientation() + pad->GetThermalSpokeAngle() ); spokeIter->Move( pad->ShapePos() ); } + + // Remove group membership from dummy item before deleting + dummy_pad.SetParentGroup( nullptr ); } // And lastly, even when we have to resort to trig, we can use it only in a post-process // after the rotated-bounding-box trick from above. @@ -1991,6 +1994,9 @@ void ZONE_FILLER::buildThermalSpokes( const ZONE* aZone, PCB_LAYER_ID aLayer, spokeIter->SetPoint( 3, end ); spokeIter->SetPoint( 4, end_p ); } + + // Remove group membership from dummy item before deleting + dummy_pad.SetParentGroup( nullptr ); } }