StartPlot can fail and leave a broken file handle

Related #15782
This commit is contained in:
Mark Roszko 2023-09-29 23:54:49 +00:00
parent bb579294a0
commit c74b0943f3
1 changed files with 21 additions and 20 deletions

View File

@ -1229,8 +1229,8 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aL
AddGerberX2Attribute( plotter, aBoard, aLayer, not useX2mode ); AddGerberX2Attribute( plotter, aBoard, aLayer, not useX2mode );
} }
plotter->StartPlot( wxT( "1" ) ); if( plotter->StartPlot( wxT( "1" ) ) )
{
// Plot the frame reference if requested // Plot the frame reference if requested
if( aPlotOpts->GetPlotFrameRef() ) if( aPlotOpts->GetPlotFrameRef() )
{ {
@ -1253,6 +1253,7 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aL
return plotter; return plotter;
} }
}
delete plotter->RenderSettings(); delete plotter->RenderSettings();
delete plotter; delete plotter;