From bdfeb9068a354f2c32dac053feb3fa4cabde2f8f Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 3 Nov 2024 09:04:58 -0500 Subject: [PATCH] Change some asserts to wxCHECKs Make sure that if these are hit, we don't double-add to m_links See https://gitlab.com/kicad/code/kicad/-/issues/19049 --- pcbnew/router/pns_link_holder.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pcbnew/router/pns_link_holder.h b/pcbnew/router/pns_link_holder.h index 89bbf1a490..5c021479b1 100644 --- a/pcbnew/router/pns_link_holder.h +++ b/pcbnew/router/pns_link_holder.h @@ -39,18 +39,15 @@ public: ///< Add a reference to an item registered in a #NODE that is a part of this line. void Link( LINKED_ITEM* aLink ) { -#ifdef DEBUG - assert ( !alg::contains( m_links, aLink ) ); -#endif + wxCHECK_MSG( !alg::contains( m_links, aLink ), /* void */, + "Trying to link an item that is already linked" ); m_links.push_back( aLink ); } void Unlink( const LINKED_ITEM* aLink ) { -#ifdef DEBUG - assert ( alg::contains( m_links, aLink ) ); -#endif - + wxCHECK_MSG( alg::contains( m_links, aLink ), /* void */, + "Trying to unlink an item that is not linked" ); alg::delete_matching( m_links, aLink ); }