From b4e0a5cbbff30e28811c5cbfea7cf21f6869e260 Mon Sep 17 00:00:00 2001 From: Kirill Mavreshko Date: Mon, 23 Jun 2014 08:50:53 +0200 Subject: [PATCH] Fixes bug #1332438: PNS router crashes when you another track while routing in "shove" mode --- pcbnew/router/pns_joint.h | 2 +- pcbnew/router/pns_node.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pcbnew/router/pns_joint.h b/pcbnew/router/pns_joint.h index 1bee21c06f..bcac27d356 100644 --- a/pcbnew/router/pns_joint.h +++ b/pcbnew/router/pns_joint.h @@ -112,7 +112,7 @@ public: LINKED_ITEMS::iterator f = std::find( m_linkedItems.begin(), m_linkedItems.end(), aItem ); if( f != m_linkedItems.end() ) - m_linkedItems.erase( f ); + f = m_linkedItems.erase( f ); return m_linkedItems.size() == 0; } diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp index 1692ae1e8d..8ee7feeb3d 100644 --- a/pcbnew/router/pns_node.cpp +++ b/pcbnew/router/pns_node.cpp @@ -1216,14 +1216,21 @@ int PNS_NODE::FindByMarker( int aMarker, PNS_ITEMSET& aItems ) int PNS_NODE::RemoveByMarker( int aMarker ) { + std::list garbage; + for( PNS_INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i ) { if ( (*i)->Marker() & aMarker ) { - Remove( *i ); + garbage.push_back( *i ); } } + for( std::list::const_iterator i = garbage.begin(), end = garbage.end(); i != end; ++i ) + { + Remove( *i ); + } + return 0; }