diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index 4a67298065..fe29d29564 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -59,8 +59,6 @@ LINE_PLACER::LINE_PLACER( ROUTER* aRouter ) : LINE_PLACER::~LINE_PLACER() { - if( m_shove ) - delete m_shove; } @@ -796,14 +794,11 @@ void LINE_PLACER::initPlacement() m_currentNode = m_world; m_currentMode = Settings().Mode(); - if( m_shove ) - delete m_shove; - - m_shove = NULL; + m_shove.reset(); if( m_currentMode == RM_Shove || m_currentMode == RM_Smart ) { - m_shove = new SHOVE( m_world->Branch(), Router() ); + m_shove.reset( new SHOVE( m_world->Branch(), Router() ) ); } } diff --git a/pcbnew/router/pns_line_placer.h b/pcbnew/router/pns_line_placer.h index 2e07cc5907..e0f33df3e7 100644 --- a/pcbnew/router/pns_line_placer.h +++ b/pcbnew/router/pns_line_placer.h @@ -368,7 +368,7 @@ private: VECTOR2I m_p_start; ///> The shove engine - SHOVE* m_shove; + std::unique_ptr< SHOVE > m_shove; ///> Current world state NODE* m_currentNode;