From 619c78622e2856ff61bc6738a14c2a86348ba470 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Mon, 12 Aug 2019 07:30:46 -0700 Subject: [PATCH] pcbnew: Initialize drag and clear links Drag is used for multiple modes so should be initialized when starting. The line that we generate however needs to be pristine in drag, so we clear the links in the duplicate. Fixes: lp:1839612 * https://bugs.launchpad.net/kicad/+bug/1839612 --- pcbnew/router/pns_dragger.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pcbnew/router/pns_dragger.cpp b/pcbnew/router/pns_dragger.cpp index 2ac808b37e..1f6c11b10a 100644 --- a/pcbnew/router/pns_dragger.cpp +++ b/pcbnew/router/pns_dragger.cpp @@ -136,10 +136,8 @@ bool DRAGGER::Start( const VECTOR2I& aP, ITEM* aStartItem ) m_currentMode = Settings().Mode(); m_freeAngleMode = (m_mode & DM_FREE_ANGLE); - if( m_currentMode == RM_Shove ) - { - m_shove.reset( new SHOVE( m_world, Router() ) ); - } + if( m_currentMode != RM_MarkObstacles ) + m_shove = std::make_unique( m_world, Router() ); aStartItem->Unmark( MK_LOCKED ); @@ -184,6 +182,7 @@ bool DRAGGER::dragMarkObstacles( const VECTOR2I& aP ) int thresh = Settings().SmoothDraggedSegments() ? m_draggedLine.Width() / 4 : 0; LINE origLine( m_draggedLine ); LINE dragged( m_draggedLine ); + dragged.ClearSegmentLinks(); if( m_mode == DM_SEGMENT ) dragged.DragSegment( aP, m_draggedSegmentIndex, thresh );