fix memory leak and missing switch to "C" locale in some handlers

PCBNEW_JOBS_HANDLER::JobExportGerber(): disable plot pad holes.
This commit is contained in:
jean-pierre charras 2022-10-31 09:13:04 +01:00
parent 355d5014f5
commit d289130627
3 changed files with 9 additions and 4 deletions

View File

@ -95,7 +95,7 @@ CLI::EXPORT_PCB_DRILL_COMMAND::EXPORT_PCB_DRILL_COMMAND() : EXPORT_PCB_BASE_COMM
int CLI::EXPORT_PCB_DRILL_COMMAND::Perform( KIWAY& aKiway )
{
JOB_EXPORT_PCB_DRILL* drillJob = new JOB_EXPORT_PCB_DRILL( true );
std::unique_ptr<JOB_EXPORT_PCB_DRILL> drillJob( new JOB_EXPORT_PCB_DRILL( true ) );
drillJob->m_filename = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
drillJob->m_outputDir = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
@ -220,7 +220,7 @@ int CLI::EXPORT_PCB_DRILL_COMMAND::Perform( KIWAY& aKiway )
return EXIT_CODES::ERR_ARGS;
}
int exitCode = aKiway.ProcessJob( KIWAY::FACE_PCB, drillJob );
int exitCode = aKiway.ProcessJob( KIWAY::FACE_PCB, drillJob.get() );
return exitCode;
}

View File

@ -28,6 +28,8 @@
#include <macros.h>
#include <wx/tokenzr.h>
#include <locale_io.h>
CLI::EXPORT_PCB_PDF_COMMAND::EXPORT_PCB_PDF_COMMAND() : EXPORT_PCB_BASE_COMMAND( "pdf" )
{
@ -65,7 +67,7 @@ int CLI::EXPORT_PCB_PDF_COMMAND::Perform( KIWAY& aKiway )
if( baseExit != EXIT_CODES::OK )
return baseExit;
JOB_EXPORT_PCB_PDF* pdfJob = new JOB_EXPORT_PCB_PDF( true );
std::unique_ptr<JOB_EXPORT_PCB_PDF> pdfJob( new JOB_EXPORT_PCB_PDF( true ) );
pdfJob->m_filename = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
pdfJob->m_outputFile = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
@ -82,7 +84,8 @@ int CLI::EXPORT_PCB_PDF_COMMAND::Perform( KIWAY& aKiway )
pdfJob->m_printMaskLayer = m_selectedLayers;
int exitCode = aKiway.ProcessJob( KIWAY::FACE_PCB, pdfJob );
LOCALE_IO dummy; // Switch to "C" locale
int exitCode = aKiway.ProcessJob( KIWAY::FACE_PCB, pdfJob.get() );
return exitCode;
}

View File

@ -246,6 +246,8 @@ int PCBNEW_JOBS_HANDLER::JobExportGerber( JOB* aJob )
plotOpts.SetLayerSelection( aGerberJob->m_printMaskLayer );
plotOpts.SetSubtractMaskFromSilk( aGerberJob->m_subtractSolderMaskFromSilk );
// Always disable plot pad holes
plotOpts.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
plotOpts.SetDisableGerberMacros( aGerberJob->m_disableApertureMacros );
plotOpts.SetUseGerberX2format( aGerberJob->m_useX2Format );