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.
This commit is contained in:
jean-pierre charras 2014-11-14 08:25:17 +01:00
parent 15aa24afe8
commit 35c591166f
3 changed files with 19 additions and 8 deletions

View File

@ -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);
}

View File

@ -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;
}
}
}

View File

@ -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)