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,29 +1229,30 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aL
AddGerberX2Attribute( plotter, aBoard, aLayer, not useX2mode );
}
plotter->StartPlot( wxT( "1" ) );
// Plot the frame reference if requested
if( aPlotOpts->GetPlotFrameRef() )
if( plotter->StartPlot( wxT( "1" ) ) )
{
PlotDrawingSheet( plotter, aBoard->GetProject(), aBoard->GetTitleBlock(),
aBoard->GetPageSettings(), &aBoard->GetProperties(), wxT( "1" ), 1,
aSheetName, aSheetPath, aBoard->GetFileName() );
// Plot the frame reference if requested
if( aPlotOpts->GetPlotFrameRef() )
{
PlotDrawingSheet( plotter, aBoard->GetProject(), aBoard->GetTitleBlock(),
aBoard->GetPageSettings(), &aBoard->GetProperties(), wxT( "1" ), 1,
aSheetName, aSheetPath, aBoard->GetFileName() );
if( aPlotOpts->GetMirror() )
initializePlotter( plotter, aBoard, aPlotOpts );
if( aPlotOpts->GetMirror() )
initializePlotter( plotter, aBoard, aPlotOpts );
}
// When plotting a negative board: draw a black rectangle (background for plot board
// in white) and switch the current color to WHITE; note the color inversion is actually
// done in the driver (if supported)
if( aPlotOpts->GetNegative() )
{
BOX2I bbox = aBoard->ComputeBoundingBox();
FillNegativeKnockout( plotter, bbox );
}
return plotter;
}
// When plotting a negative board: draw a black rectangle (background for plot board
// in white) and switch the current color to WHITE; note the color inversion is actually
// done in the driver (if supported)
if( aPlotOpts->GetNegative() )
{
BOX2I bbox = aBoard->ComputeBoundingBox();
FillNegativeKnockout( plotter, bbox );
}
return plotter;
}
delete plotter->RenderSettings();