From e9f8454a67d75d2c23d30c28a78c28585e3a29f2 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 16 Oct 2022 18:37:19 +0100 Subject: [PATCH] No DRC engine in footprint editor. Fixes https://gitlab.com/kicad/code/kicad/issues/12658 --- pcbnew/tools/edit_tool_move_fct.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/pcbnew/tools/edit_tool_move_fct.cpp b/pcbnew/tools/edit_tool_move_fct.cpp index c56371d654..f8a2ef5122 100644 --- a/pcbnew/tools/edit_tool_move_fct.cpp +++ b/pcbnew/tools/edit_tool_move_fct.cpp @@ -431,11 +431,14 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, bool aPickReference ) && board->IsElementVisible( LAYER_CONFLICTS_SHADOW ); // Used to test courtyard overlaps - std::shared_ptr drcEngine = m_toolMgr->GetTool()->GetDRCEngine(); - DRC_INTERACTIVE_COURTYARD_CLEARANCE drc_on_move( drcEngine ); + std::unique_ptr drc_on_move = nullptr; if( showCourtyardConflicts ) - drc_on_move.Init( board ); + { + std::shared_ptr drcEngine = m_toolMgr->GetTool()->GetDRCEngine(); + drc_on_move.reset( new DRC_INTERACTIVE_COURTYARD_CLEARANCE( drcEngine ) ); + drc_on_move->Init( board ); + } displayConstraintsMessage( hv45Mode ); @@ -538,10 +541,10 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, bool aPickReference ) hasRedrawn3D = true; } - if( showCourtyardConflicts && drc_on_move.m_FpInMove.size() ) + if( showCourtyardConflicts && drc_on_move->m_FpInMove.size() ) { - drc_on_move.Run(); - drc_on_move.UpdateConflicts( m_toolMgr->GetView(), true ); + drc_on_move->Run(); + drc_on_move->UpdateConflicts( m_toolMgr->GetView(), true ); } m_toolMgr->PostEvent( EVENTS::SelectedItemsMoved ); @@ -628,8 +631,8 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, bool aPickReference ) { items.push_back( static_cast( item ) ); - if( item->Type() == PCB_FOOTPRINT_T ) - drc_on_move.m_FpInMove.push_back( static_cast( item ) ); + if( showCourtyardConflicts && item->Type() == PCB_FOOTPRINT_T ) + drc_on_move->m_FpInMove.push_back( static_cast( item ) ); } m_cursor = grid.BestDragOrigin( originalCursorPos, items ); @@ -737,7 +740,8 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, bool aPickReference ) } while( ( evt = Wait() ) ); // Assignment (instead of equality test) is intentional // Clear temporary COURTYARD_CONFLICT flag and ensure the conflict shadow is cleared - drc_on_move.ClearConflicts( m_toolMgr->GetView() ); + if( showCourtyardConflicts ) + drc_on_move->ClearConflicts( m_toolMgr->GetView() ); controls->ForceCursorPosition( false ); controls->ShowCursor( false );