From 35c591166f0357e714ff1ae28488a907a0d89012 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 14 Nov 2014 08:25:17 +0100 Subject: [PATCH] Pcbnew: fix Bug #1391561 (PCBNew segfaults on BOM creation). Does not happen on all platforms. Could be due to use of data just previoulsy deleted. Very minor other changes. --- pcbnew/build_BOM_from_board.cpp | 10 ++++++---- pcbnew/plot_board_layers.cpp | 15 ++++++++++++--- pcbnew/tool_pcb.cpp | 2 +- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/pcbnew/build_BOM_from_board.cpp b/pcbnew/build_BOM_from_board.cpp index 3813ff36ea..6a7c2e71fe 100644 --- a/pcbnew/build_BOM_from_board.cpp +++ b/pcbnew/build_BOM_from_board.cpp @@ -163,20 +163,22 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent ) module = module->Next(); } - // Print list - for( iter = list.begin(); iter != list.end(); iter++ ) + // Print list. Also delete temporary created objects. + for( size_t ii = list.GetCount(); ii > 0; ii-- ) { - cmp* current = *iter; + cmp* current = *list.begin(); // Because the first object will be removed + // from list, all objects will be get here msg.Empty(); msg << current->m_Id << wxT( ";\"" ); msg << current->m_Ref << wxT( "\";\"" ); - msg << FROM_UTF8( current->m_fpid.Format().c_str() ) << wxT( "\";" ); + msg << FROM_UTF8( current->m_fpid.GetFootprintName().c_str() ) << wxT( "\";" ); msg << current->m_CmpCount << wxT( ";\"" ); msg << current->m_Val << wxT( "\";;;\n" ); fprintf( fp_bom, "%s", TO_UTF8( msg ) ); + // We do not need this object, now: remove it from list and delete it list.DeleteObject( current ); delete (current); } diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index 1efcd8ad06..8e412f50f3 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -252,15 +252,24 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, LAYER_ID aLayer, case B_CrtYd: case F_Fab: case B_Fab: - PlotSilkScreen( aBoard, aPlotter, layer_mask, plotOpt ); - break; + plotOpt.SetSkipPlotNPTH_Pads( false ); + plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE ); - default: if( plotOpt.GetFormat() == PLOT_FORMAT_DXF ) PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt ); else PlotSilkScreen( aBoard, aPlotter, layer_mask, plotOpt ); break; + + default: + plotOpt.SetSkipPlotNPTH_Pads( false ); + plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE ); + + if( plotOpt.GetFormat() == PLOT_FORMAT_DXF ) + PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt ); + else + PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt ); + break; } } } diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index 4ec9569bef..6b02f5a597 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -306,7 +306,7 @@ void PCB_EDIT_FRAME::ReCreateHToolbar() m_mainToolBar->AddSeparator(); m_mainToolBar->AddTool( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, wxEmptyString, KiBitmap( web_support_xpm ), - _( "Fast access to the Web Based FreeROUTE advanced router" ) ); + _( "Fast access to the FreeROUTE external advanced router" ) ); // Access to the scripting console #if defined(KICAD_SCRIPTING_WXPYTHON)