From 1d063e1420cde1952b2c0de046c29ec879b93fd5 Mon Sep 17 00:00:00 2001 From: Marek Roszko <mark.roszko@gmail.com> Date: Wed, 25 Dec 2024 10:05:33 -0500 Subject: [PATCH] Actually handle svg plot job failure correctly --- pcbnew/exporters/export_svg.cpp | 20 ++++++++++++-------- pcbnew/pcbnew_jobs_handler.cpp | 8 ++++++-- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/pcbnew/exporters/export_svg.cpp b/pcbnew/exporters/export_svg.cpp index 7cc868c13e..b0097161ed 100644 --- a/pcbnew/exporters/export_svg.cpp +++ b/pcbnew/exporters/export_svg.cpp @@ -117,13 +117,17 @@ bool EXPORT_SVG::Plot( BOARD* aBoard, const PCB_PLOT_SVG_OPTIONS& aSvgPlotOption plotter->SetColorMode( !aSvgPlotOptions.m_blackAndWhite ); PlotBoardLayers( aBoard, plotter, aSvgPlotOptions.m_printMaskLayer, plot_opts ); plotter->EndPlot(); + + delete plotter; + + // reset to the values saved earlier + aBoard->GetDesignSettings().SetAuxOrigin( savedAuxOrigin ); + aBoard->SetPageSettings( savedPageInfo ); + + return true; + } + else + { + return false; } - - delete plotter; - - // reset to the values saved earlier - aBoard->GetDesignSettings().SetAuxOrigin( savedAuxOrigin ); - aBoard->SetPageSettings( savedPageInfo ); - - return true; } diff --git a/pcbnew/pcbnew_jobs_handler.cpp b/pcbnew/pcbnew_jobs_handler.cpp index 99c22b38c9..64154f15a2 100644 --- a/pcbnew/pcbnew_jobs_handler.cpp +++ b/pcbnew/pcbnew_jobs_handler.cpp @@ -651,11 +651,15 @@ int PCBNEW_JOBS_HANDLER::JobExportSvg( JOB* aJob ) brd->SynchronizeProperties(); if( EXPORT_SVG::Plot( brd, svgPlotOptions ) ) + { m_reporter->Report( _( "Successfully created svg file" ) + wxS( "\n" ), RPT_SEVERITY_INFO ); + return CLI::EXIT_CODES::OK; + } else + { m_reporter->Report( _( "Error creating svg file" ) + wxS( "\n" ), RPT_SEVERITY_ERROR ); - - return CLI::EXIT_CODES::OK; + return CLI::EXIT_CODES::ERR_INVALID_OUTPUT_CONFLICT; + } }