diff --git a/common/database/database_connection.cpp b/common/database/database_connection.cpp index ea023c9034..8fc7bf4d92 100644 --- a/common/database/database_connection.cpp +++ b/common/database/database_connection.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2022 Jon Evans - * Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -178,7 +178,15 @@ bool DATABASE_CONNECTION::Disconnect() return false; } - m_conn->disconnect(); + try + { + m_conn->disconnect(); + } + catch( boost::locale::conv::conversion_error& exc ) + { + wxLogTrace( traceDatabase, wxT( "Disconnect() error \"%s\" occured." ), exc.what() ); + return false; + } return !m_conn->connected(); } diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp index 4e75a3510e..c1dc38300e 100644 --- a/common/eda_draw_frame.cpp +++ b/common/eda_draw_frame.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2004-2017 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008 Wayne Stambaugh - * Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2004-2023 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -78,12 +78,16 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER ) EVT_ACTIVATE( EDA_DRAW_FRAME::onActivate ) END_EVENT_TABLE() + bool EDA_DRAW_FRAME::m_openGLFailureOccured = false; + EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType, const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize, - long aStyle, const wxString& aFrameName, const EDA_IU_SCALE& aIuScale ) : - KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName, aIuScale ) + long aStyle, const wxString& aFrameName, + const EDA_IU_SCALE& aIuScale ) : + KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName, aIuScale ), + m_socketServer( nullptr ) { m_socketServer = nullptr; m_mainToolBar = nullptr; @@ -171,8 +175,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame OnMove( dummy ); // we need to kludge the msg panel to the correct size again - // especially important even for first launches as the constructor of the window here usually doesn't - // have the correct dpi awareness yet + // especially important even for first launches as the constructor of the window + // here usually doesn't have the correct dpi awareness yet m_frameSize.y += m_msgFrameHeight; m_msgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight( this ); m_frameSize.y -= m_msgFrameHeight; @@ -609,7 +613,8 @@ void EDA_DRAW_FRAME::DisplayGridMsg() { wxString msg; - msg.Printf( wxS( "grid %s" ), MessageTextFromValue( GetCanvas()->GetGAL()->GetGridSize().x, false ) ); + msg.Printf( wxS( "grid %s" ), MessageTextFromValue( GetCanvas()->GetGAL()->GetGridSize().x, + false ) ); SetStatusText( msg, 4 ); } diff --git a/common/widgets/search_pane.cpp b/common/widgets/search_pane.cpp index 31ce822ece..95613c00bf 100644 --- a/common/widgets/search_pane.cpp +++ b/common/widgets/search_pane.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -42,6 +42,8 @@ void SEARCH_PANE::OnLanguageChange() wxWindow* page = m_notebook->GetPage( i ); SEARCH_PANE_TAB* tab = dynamic_cast( page ); + wxCHECK( tab, /* void */ ); + tab->RefreshColumnNames(); m_notebook->SetPageText( i, wxGetTranslation( tab->GetSearchHandler()->GetName() ) ); } @@ -103,4 +105,4 @@ void SEARCH_PANE::OnNotebookPageChanged( wxBookCtrlEvent& aEvent ) SEARCH_PANE_TAB* SEARCH_PANE::GetCurrentTab() const { return dynamic_cast( m_notebook->GetCurrentPage() ); -} \ No newline at end of file +} diff --git a/eeschema/dialogs/dialog_lib_text_properties.cpp b/eeschema/dialogs/dialog_lib_text_properties.cpp index 08a1ad6b4c..fb90a6d7b2 100644 --- a/eeschema/dialogs/dialog_lib_text_properties.cpp +++ b/eeschema/dialogs/dialog_lib_text_properties.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2001 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 2004-2022 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2004-2023 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -122,10 +122,14 @@ DIALOG_LIB_TEXT_PROPERTIES::~DIALOG_LIB_TEXT_PROPERTIES() bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow() { - LIB_SYMBOL* symbol = m_graphicText->GetParent(); + LIB_SYMBOL* symbol = nullptr; if( m_graphicText ) { + symbol = m_graphicText->GetParent(); + + wxCHECK( symbol, false ); + m_textSize.SetValue( m_graphicText->GetTextWidth() ); m_StyledTextCtrl->SetValue( m_graphicText->GetText() ); m_StyledTextCtrl->EmptyUndoBuffer(); diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index b7402937d3..c787682e5d 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2004-2023 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -189,7 +189,8 @@ wxString SCH_FIELD::GetShownText( int aDepth, bool aAllowExtraText ) const std::function labelResolver = [&]( wxString* token ) -> bool { - return static_cast( m_parent )->ResolveTextVar( token, aDepth + 1 ); + return static_cast( m_parent )->ResolveTextVar( token, + aDepth + 1 ); }; wxString text = EDA_TEXT::GetShownText(); @@ -1040,6 +1041,8 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter, bool aBackground ) const std::vector pageHrefs; BOX2I bbox = GetBoundingBox(); + wxCHECK( label, /* void */ ); + label->GetIntersheetRefs( &pages ); for( const std::pair& page : pages ) diff --git a/pcbnew/board_commit.cpp b/pcbnew/board_commit.cpp index 004c6612da..57ecb2b6e2 100644 --- a/pcbnew/board_commit.cpp +++ b/pcbnew/board_commit.cpp @@ -76,12 +76,14 @@ BOARD* BOARD_COMMIT::GetBoard() const COMMIT& BOARD_COMMIT::Stage( EDA_ITEM* aItem, CHANGE_TYPE aChangeType ) { + wxCHECK( aItem, *this ); + aItem->ClearFlags( IS_MODIFIED_CHILD ); // If aItem belongs a footprint, the full footprint will be saved because undo/redo does // not handle "sub items" modifications. This has implications for auto-zone-refill, so // we need to store a bit more information. - if( aItem && aChangeType == CHT_MODIFY ) + if( aChangeType == CHT_MODIFY ) { if( aItem->Type() == PCB_FOOTPRINT_T ) { diff --git a/pcbnew/dialogs/dialog_graphic_item_properties.cpp b/pcbnew/dialogs/dialog_graphic_item_properties.cpp index bd04916d67..f2a060f107 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 Jean-Pierre Charras jp.charras at wanadoo.fr - * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -43,22 +43,9 @@ #include #include + class DIALOG_GRAPHIC_ITEM_PROPERTIES : public DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE { -private: - PCB_BASE_EDIT_FRAME* m_parent; - PCB_SHAPE* m_item; - FP_SHAPE* m_fp_item; - - UNIT_BINDER m_startX, m_startY; - UNIT_BINDER m_endX, m_endY; - UNIT_BINDER m_angle; - UNIT_BINDER m_thickness; - UNIT_BINDER m_bezierCtrl1X, m_bezierCtrl1Y; - UNIT_BINDER m_bezierCtrl2X, m_bezierCtrl2Y; - - bool m_flipStartEnd; - public: DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BOARD_ITEM* aItem ); ~DIALOG_GRAPHIC_ITEM_PROPERTIES() {}; @@ -79,6 +66,20 @@ private: void onFilledCheckbox( wxCommandEvent& event ) override; bool Validate() override; + +private: + PCB_BASE_EDIT_FRAME* m_parent; + PCB_SHAPE* m_item; + FP_SHAPE* m_fp_item; + + UNIT_BINDER m_startX, m_startY; + UNIT_BINDER m_endX, m_endY; + UNIT_BINDER m_angle; + UNIT_BINDER m_thickness; + UNIT_BINDER m_bezierCtrl1X, m_bezierCtrl1Y; + UNIT_BINDER m_bezierCtrl2X, m_bezierCtrl2Y; + + bool m_flipStartEnd; }; DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, @@ -441,7 +442,7 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate() double max_offset = std::max( std::abs( center.x ) + radius, std::abs( center.y ) + radius ); - if( max_offset >= ( std::numeric_limits::max() / 2 ) + if( max_offset >= ( std::numeric_limits::max() / 2.0 ) || center == start || center == end ) { errors.Add( wxString::Format( _( "Invalid Arc with radius %f and angle %f." ), diff --git a/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp b/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp index d8f70dde53..4fa64f8110 100644 --- a/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp +++ b/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp @@ -392,6 +392,8 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run() int length = dp.coupledN.Length(); int gap = dp.coupledN.Distance( dp.coupledP ); + wxCHECK2( dp.parentN && dp.parentP, continue ); + gap -= dp.parentN->GetWidth() / 2; gap -= dp.parentP->GetWidth() / 2; diff --git a/pcbnew/netinfo_list.cpp b/pcbnew/netinfo_list.cpp index 5f8dd14928..4ca38753ab 100644 --- a/pcbnew/netinfo_list.cpp +++ b/pcbnew/netinfo_list.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -33,12 +33,11 @@ // Constructor and destructor NETINFO_LIST::NETINFO_LIST( BOARD* aParent ) : - m_parent( aParent ) + m_parent( aParent ), + m_newNetCode( 0 ) { // Make sure that the unconnected net has number 0 AppendNet( new NETINFO_ITEM( aParent, wxEmptyString, 0 ) ); - - m_newNetCode = 0; } @@ -51,6 +50,7 @@ NETINFO_LIST::~NETINFO_LIST() void NETINFO_LIST::clear() { NETNAMES_MAP::iterator it, itEnd; + for( it = m_netNames.begin(), itEnd = m_netNames.end(); it != itEnd; ++it ) delete it->second; diff --git a/pcbnew/plugins/pcad/pcb_footprint.cpp b/pcbnew/plugins/pcad/pcb_footprint.cpp index a530cf02ba..0c5b5cc214 100644 --- a/pcbnew/plugins/pcad/pcb_footprint.cpp +++ b/pcbnew/plugins/pcad/pcb_footprint.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2007, 2008 Lubo Racko * Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev - * Copyright (C) 2012-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2012-2023 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -315,7 +315,6 @@ void PCB_FOOTPRINT::DoLayerContentsObjects( XNODE* aNode, PCB_FOOTPRINT* aFootpr if( m_callbacks->GetLayerType( PCadLayer ) == LAYER_TYPE_PLANE ) { plane_layer_polygon = new VERTICES_ARRAY; - wxASSERT( plane_layer ); plane_layer->FormPolygon( lNode, plane_layer_polygon, aDefaultMeasurementUnit, aActualConversion ); plane_layer->m_cutouts.Add( plane_layer_polygon ); diff --git a/pcbnew/router/pns_logger.cpp b/pcbnew/router/pns_logger.cpp index 7d4ae99ef5..6cc09787f0 100644 --- a/pcbnew/router/pns_logger.cpp +++ b/pcbnew/router/pns_logger.cpp @@ -2,7 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2014 CERN - * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors. * Author: Tomasz Wlostowski * * This program is free software: you can redistribute it and/or modify it @@ -61,13 +61,14 @@ void LOGGER::Save( const std::string& aFilename ) } -void LOGGER::Log( LOGGER::EVENT_TYPE evt, const VECTOR2I& pos, const ITEM* item, const SIZES_SETTINGS* sizes ) +void LOGGER::Log( LOGGER::EVENT_TYPE evt, const VECTOR2I& pos, const ITEM* item, + const SIZES_SETTINGS* sizes ) { LOGGER::EVENT_ENTRY ent; ent.type = evt; ent.p = pos; - ent.uuid = KIID(0); + ent.uuid = KIID( 0 ); if( sizes ) { diff --git a/pcbnew/router/pns_logger.h b/pcbnew/router/pns_logger.h index dac38ca01c..534ffef78f 100644 --- a/pcbnew/router/pns_logger.h +++ b/pcbnew/router/pns_logger.h @@ -2,7 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2014 CERN - * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors. * Author: Tomasz Wlostowski * * This program is free software: you can redistribute it and/or modify it @@ -65,7 +65,8 @@ public: void Save( const std::string& aFilename ); void Clear(); - void Log( EVENT_TYPE evt, const VECTOR2I& pos = VECTOR2I(), const ITEM* item = nullptr, const SIZES_SETTINGS* sizes = nullptr ); + void Log( EVENT_TYPE evt, const VECTOR2I& pos = VECTOR2I(), const ITEM* item = nullptr, + const SIZES_SETTINGS* sizes = nullptr ); const std::vector& GetEvents() { diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp index 948a8399aa..43c4c4994e 100644 --- a/pcbnew/router/pns_node.cpp +++ b/pcbnew/router/pns_node.cpp @@ -2,7 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2019 CERN - * Copyright (C) 2016-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors. * * @author Tomasz Wlostowski * @@ -275,7 +275,8 @@ int NODE::QueryColliding( const ITEM* aItem, NODE::OBSTACLES& aObstacles, int aK if( aItem->IsVirtual() ) return 0; - DEFAULT_OBSTACLE_VISITOR visitor( aObstacles, aItem, aKindMask, aDifferentNetsOnly, aOverrideClearance ); + DEFAULT_OBSTACLE_VISITOR visitor( aObstacles, aItem, aKindMask, aDifferentNetsOnly, + aOverrideClearance ); #ifdef DEBUG assert( allocNodes.find( this ) != allocNodes.end() ); @@ -324,6 +325,7 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aLine, int aKindMask, OBSTACLE nearest; nearest.m_item = nullptr; nearest.m_distFirst = INT_MAX; + nearest.m_maxFanoutWidth = 0; auto updateNearest = [&]( const SHAPE_LINE_CHAIN::INTERSECTION& pt, ITEM* obstacle, @@ -348,7 +350,6 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aLine, int aKindMask, std::vector intersectingPts; int layer = aLine->Layer(); - for( const OBSTACLE& obstacle : obstacleList ) { if( aRestrictedSet && aRestrictedSet->find( obstacle.m_item ) == aRestrictedSet->end() ) @@ -720,9 +721,10 @@ void NODE::Add( std::unique_ptr< ITEM > aItem, bool aAllowRedundant ) case ITEM::LINE_T: { - //fixme(twl): I don't like unique_ptr in this methods as the router has its own garbage collecting - //mechanism. This particular case is used exclusively in ROUTER::GetUpdatedItems() for - //dumping debug logs. Please don't call Add ( up ) otherwise, dragons live here. + // fixme(twl): I don't like unique_ptr in this methods as the router has its own garbage + // collecting mechanism. This particular case is used exclusively in + // ROUTER::GetUpdatedItems() for dumping debug logs. Please don't call Add ( up ) + // otherwise, dragons live here. LINE *l = static_cast( aItem.get() ); Add( *l ); break; @@ -1072,7 +1074,7 @@ const LINE NODE::AssembleLine( LINKED_ITEM* aSeg, int* aOriginSegmentIndex, // Remove duplicate verts, but do NOT remove colinear segments here! pl.Line().Simplify( false ); - // TODO: maintain actual segment index under simplifcation system + // TODO: maintain actual segment index under simplification system if( aOriginSegmentIndex && *aOriginSegmentIndex >= pl.SegmentCount() ) *aOriginSegmentIndex = pl.SegmentCount() - 1; @@ -1275,8 +1277,7 @@ JOINT& NODE::touchJoint( const VECTOR2I& aPos, const LAYER_RANGE& aLayers, int a break; } } - } - while( merged ); + } while( merged ); return m_joints.insert( TagJointPair( tag, jt ) )->second; } diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index d2023da43c..4766ff0314 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -2,7 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2014 CERN - * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors. * Author: Tomasz Wlostowski * * This program is free software: you can redistribute it and/or modify it @@ -142,7 +142,9 @@ const ITEM_SET ROUTER::QueryHoverItems( const VECTOR2I& aP, bool aUseClearance ) } } else + { return m_placer->CurrentNode()->HitTest( aP ); + } } @@ -776,7 +778,7 @@ bool ROUTER::movePlacing( const VECTOR2I& aP, ITEM* aEndItem ) void ROUTER::GetUpdatedItems( std::vector& aRemoved, std::vector& aAdded, std::vector& aHeads ) { - NODE *node; + NODE *node = nullptr; ITEM_SET current; if( m_state == ROUTE_TRACK ) @@ -790,6 +792,11 @@ void ROUTER::GetUpdatedItems( std::vector& aRemoved, std::vectorTraces(); } + // There probably should be a debugging assertion and possibly a PNS_LOGGER call here but + // I'm not sure how to be proceed WLS. + if( !node ) + return; + node->GetUpdatedItems( aRemoved, aAdded ); for( auto item : current.CItems() ) diff --git a/pcbnew/router/pns_sizes_settings.h b/pcbnew/router/pns_sizes_settings.h index b83b5e8914..b74ab87615 100644 --- a/pcbnew/router/pns_sizes_settings.h +++ b/pcbnew/router/pns_sizes_settings.h @@ -2,7 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2014 CERN - * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2016, 2023 KiCad Developers, see AUTHORS.txt for contributors. * Author: Tomasz Wlostowski * * This program is free software: you can redistribute it and/or modify it @@ -49,7 +49,8 @@ public: m_diffPairGap( 180000 ), m_diffPairViaGap( 180000 ), m_diffPairViaGapSameAsTraceGap( true ), - m_holeToHole( 0 ) + m_holeToHole( 0 ), + m_diffPairHoleToHole( 0 ) {}; ~SIZES_SETTINGS() {}; @@ -84,7 +85,11 @@ public: void SetDiffPairWidth( int aWidth ) { m_diffPairWidth = aWidth; } void SetDiffPairGap( int aGap ) { m_diffPairGap = aGap; } - void SetDiffPairViaGapSameAsTraceGap ( bool aEnable ) { m_diffPairViaGapSameAsTraceGap = aEnable; } + void SetDiffPairViaGapSameAsTraceGap ( bool aEnable ) + { + m_diffPairViaGapSameAsTraceGap = aEnable; + } + void SetDiffPairViaGap( int aGap ) { m_diffPairViaGap = aGap; } int ViaDiameter() const { return m_viaDiameter; } diff --git a/pcbnew/router/router_preview_item.cpp b/pcbnew/router/router_preview_item.cpp index 0604d8532f..18f110f02f 100644 --- a/pcbnew/router/router_preview_item.cpp +++ b/pcbnew/router/router_preview_item.cpp @@ -2,7 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2014 CERN - * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors. * Author: Tomasz Wlostowski * * This program is free software: you can redistribute it and/or modify it @@ -195,6 +195,8 @@ const BOX2I ROUTER_PREVIEW_ITEM::ViewBBox() const void ROUTER_PREVIEW_ITEM::drawLineChain( const SHAPE_LINE_CHAIN_BASE* aL, KIGFX::GAL* gal ) const { + wxCHECK( aL, /* void */ ); + gal->SetIsFill( false ); for( int s = 0; s < aL->GetSegmentCount(); s++ ) @@ -211,7 +213,7 @@ void ROUTER_PREVIEW_ITEM::drawLineChain( const SHAPE_LINE_CHAIN_BASE* aL, KIGFX: gal->DrawArc( arc.GetCenter(), arc.GetRadius(), start_angle, start_angle + angle); } - if( aL && aL->IsClosed() ) + if( aL->IsClosed() ) gal->DrawLine( aL->GetSegment( -1 ).B, aL->GetSegment( 0 ).A ); } diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index ec337cb0c4..aa45bde477 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -756,7 +756,18 @@ bool PCB_SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag, // Apply some ugly heuristics to avoid disambiguation menus whenever possible if( collector.GetCount() > 1 && !m_skip_heuristics ) - GuessSelectionCandidates( collector, aWhere ); + { + try + { + GuessSelectionCandidates( collector, aWhere ); + } + catch( const ClipperLib::clipperException& exc ) + { + wxLogWarning( wxS( "Exception \"%s\" occurred attemption to guess selection " + "candidates." ), exc.what() ); + return false; + } + } // If still more than one item we're going to have to ask the user. if( collector.GetCount() > 1 )