From 2aef1a4568f2d5abffcd5db7deeb0abe94fc5c97 Mon Sep 17 00:00:00 2001 From: decimad Date: Mon, 29 Aug 2016 20:42:56 +0200 Subject: [PATCH] use unique_ptr to document ownership (PNS::LINE_PLACER) --- pcbnew/router/pns_line_placer.cpp | 9 ++------- pcbnew/router/pns_line_placer.h | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) 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;