kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #21327
Re: [PATCH] Segfault in PNS on BZR 6317
On 17.11.2015 20:07, Andrew Zonenberg wrote:
> Hi,
>
> I'm getting crashes in the PNS on latest BZR in both debug and release
> builds.
>
Hi Wayne,
Patch for the segfault in the attachment. There are also two more bugfixes:
#1514081: recalculation of the ratsnest after drawing a zone in the GAL
#1514126: performance improvement in zone processing code (it was using
too much strict simplification)
Cheers,
Tom
>From 42b43b3b9b037c8ffaaf94868889d97d0081831e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomasz=20W=C5=82ostowski?= <tomasz.wlostowski@xxxxxxx>
Date: Wed, 18 Nov 2015 10:40:16 +0100
Subject: [PATCH 1/3] router: fixed segfault caused by invalidation of the end
item by PNS_LINE_PLACER::UpdateSizes()
---
pcbnew/router/pns_line_placer.cpp | 4 ----
pcbnew/router/pns_router.cpp | 5 -----
pcbnew/router/pns_router.h | 4 ----
pcbnew/router/router_tool.cpp | 10 ++++++----
pcbnew/router/router_tool.h | 2 +-
5 files changed, 7 insertions(+), 18 deletions(-)
diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp
index 96aa6de..7f4efb4 100644
--- a/pcbnew/router/pns_line_placer.cpp
+++ b/pcbnew/router/pns_line_placer.cpp
@@ -87,9 +87,6 @@ bool PNS_LINE_PLACER::ToggleVia( bool aEnabled )
if( !aEnabled )
m_head.RemoveVia();
- if( !m_idle )
- Move( m_currentEnd, NULL );
-
return true;
}
@@ -1021,7 +1018,6 @@ void PNS_LINE_PLACER::UpdateSizes( const PNS_SIZES_SETTINGS& aSizes )
if( !m_idle )
{
initPlacement( m_splitSeg );
- Move ( m_currentEnd, NULL );
}
}
diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp
index af940da..6f64f96 100644
--- a/pcbnew/router/pns_router.cpp
+++ b/pcbnew/router/pns_router.cpp
@@ -458,7 +458,6 @@ PNS_ROUTER::PNS_ROUTER()
m_showInterSteps = false;
m_snapshotIter = 0;
m_view = NULL;
- m_currentEndItem = NULL;
m_snappingEnabled = false;
m_violation = false;
m_gridHelper = NULL;
@@ -646,7 +645,6 @@ bool PNS_ROUTER::StartRouting( const VECTOR2I& aP, PNS_ITEM* aStartItem, int aLa
return false;
m_currentEnd = aP;
- m_currentEndItem = NULL;
m_state = ROUTE_TRACK;
return rv;
}
@@ -724,7 +722,6 @@ void PNS_ROUTER::DisplayDebugPoint( const VECTOR2I aPos, int aType )
void PNS_ROUTER::Move( const VECTOR2I& aP, PNS_ITEM* endItem )
{
m_currentEnd = aP;
- m_currentEndItem = endItem;
switch( m_state )
{
@@ -827,7 +824,6 @@ void PNS_ROUTER::UpdateSizes ( const PNS_SIZES_SETTINGS& aSizes )
if( m_state == ROUTE_TRACK)
{
m_placer->UpdateSizes( m_sizes );
- movePlacing( m_currentEnd, m_currentEndItem );
}
}
@@ -997,7 +993,6 @@ void PNS_ROUTER::FlipPosture()
if( m_state == ROUTE_TRACK )
{
m_placer->FlipPosture();
- movePlacing ( m_currentEnd, m_currentEndItem );
}
}
diff --git a/pcbnew/router/pns_router.h b/pcbnew/router/pns_router.h
index 0541dec..4bc4bc3 100644
--- a/pcbnew/router/pns_router.h
+++ b/pcbnew/router/pns_router.h
@@ -263,13 +263,9 @@ private:
KIGFX::VIEW* m_view;
KIGFX::VIEW_GROUP* m_previewItems;
- PNS_ITEM* m_currentEndItem;
-
bool m_snappingEnabled;
bool m_violation;
- // optHoverItem m_startItem, m_endItem;
-
PNS_ROUTING_SETTINGS m_settings;
PNS_PCBNEW_CLEARANCE_FUNC* m_clearanceFunc;
diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp
index 4b610a3..387e03c 100644
--- a/pcbnew/router/router_tool.cpp
+++ b/pcbnew/router/router_tool.cpp
@@ -382,7 +382,7 @@ void ROUTER_TOOL::switchLayerOnViaPlacement()
}
-bool ROUTER_TOOL::onViaCommand( VIATYPE_T aType )
+bool ROUTER_TOOL::onViaCommand( TOOL_EVENT& aEvent, VIATYPE_T aType )
{
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
@@ -475,6 +475,8 @@ bool ROUTER_TOOL::onViaCommand( VIATYPE_T aType )
m_router->UpdateSizes( sizes );
m_router->ToggleViaPlacement();
+ updateEndItem( aEvent );
+
m_router->Move( m_endSnapPoint, m_endItem ); // refresh
return false;
@@ -576,15 +578,15 @@ void ROUTER_TOOL::performRouting()
}
else if( evt->IsAction( &ACT_PlaceThroughVia ) )
{
- onViaCommand( VIA_THROUGH );
+ onViaCommand( *evt, VIA_THROUGH );
}
else if( evt->IsAction( &ACT_PlaceBlindVia ) )
{
- onViaCommand( VIA_BLIND_BURIED );
+ onViaCommand( *evt, VIA_BLIND_BURIED );
}
else if( evt->IsAction( &ACT_PlaceMicroVia ) )
{
- onViaCommand( VIA_MICROVIA );
+ onViaCommand( *evt, VIA_MICROVIA );
}
else if( evt->IsAction( &ACT_SwitchPosture ) )
{
diff --git a/pcbnew/router/router_tool.h b/pcbnew/router/router_tool.h
index 08f2f84..c1bd1a2 100644
--- a/pcbnew/router/router_tool.h
+++ b/pcbnew/router/router_tool.h
@@ -54,7 +54,7 @@ private:
int getStartLayer( const PNS_ITEM* aItem );
void switchLayerOnViaPlacement();
- bool onViaCommand( VIATYPE_T aType );
+ bool onViaCommand( TOOL_EVENT& aEvent, VIATYPE_T aType );
bool prepareInteractive();
bool finishInteractive();
--
1.9.1
>From b3a5a3e837ffd3feffb1182d48a85fcaa93695b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomasz=20W=C5=82ostowski?= <tomasz.wlostowski@xxxxxxx>
Date: Wed, 18 Nov 2015 10:40:44 +0100
Subject: [PATCH 2/3] GAL zone drawing tool updates the ratsnest after zone
drawing complete
---
pcbnew/tools/drawing_tool.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp
index 8344498..10c46fd 100644
--- a/pcbnew/tools/drawing_tool.cpp
+++ b/pcbnew/tools/drawing_tool.cpp
@@ -39,6 +39,7 @@
#include <gal/graphics_abstraction_layer.h>
#include <tool/tool_manager.h>
#include <router/direction.h>
+#include <ratsnest_data.h>
#include <class_board.h>
#include <class_edge_mod.h>
@@ -1125,6 +1126,7 @@ int DRAWING_TOOL::drawZone( bool aKeepout )
static_cast<PCB_EDIT_FRAME*>( m_frame )->Fill_Zone( zone );
zone->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
+ m_board->GetRatsnest()->Update( zone );
m_frame->OnModify();
m_frame->SaveCopyInUndoList( zone, UR_NEW );
--
1.9.1
>From 2945af2b9352873f8eeb5462d0e5410e1c4ffd02 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomasz=20W=C5=82ostowski?= <tomasz.wlostowski@xxxxxxx>
Date: Wed, 18 Nov 2015 10:41:47 +0100
Subject: [PATCH 3/3] Fixed performance issue in zones processing (use strict
simplification only for the final filled area)
---
pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
index 7bcb15b..bc79c76 100644
--- a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
+++ b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
@@ -442,12 +442,12 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList_NG( BOARD* aPcb )
if(g_DumpZonesWhenFilling)
dumper->Write( &holes, "feature-holes" );
- holes.Simplify();
+ holes.Simplify( true );
if (g_DumpZonesWhenFilling)
dumper->Write( &holes, "feature-holes-postsimplify" );
- solidAreas.BooleanSubtract( holes );
+ solidAreas.BooleanSubtract( holes, true );
if (g_DumpZonesWhenFilling)
dumper->Write( &solidAreas, "solid-areas-minus-holes" );
--
1.9.1
Follow ups
References