mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Don't allow default copy c'tor to copy arrays of pointers.
Fixes KICAD-SJ2. Fixes https://gitlab.com/kicad/code/kicad/-/issues/21408
This commit is contained in:
parent
ed40391bde
commit
d91cce930f
@ -135,15 +135,6 @@ JOBSET_DESTINATION::JOBSET_DESTINATION( const wxString& id, JOBSET_DESTINATION_T
|
||||
}
|
||||
|
||||
|
||||
JOBSET_DESTINATION::~JOBSET_DESTINATION()
|
||||
{
|
||||
for( auto& [name, reporter] : m_lastRunReporters )
|
||||
delete reporter;
|
||||
|
||||
m_lastRunReporters.clear();
|
||||
}
|
||||
|
||||
|
||||
void JOBSET_DESTINATION::InitOutputHandler()
|
||||
{
|
||||
if( m_type == JOBSET_DESTINATION_T::FOLDER )
|
||||
|
@ -21,15 +21,53 @@
|
||||
#ifndef JOBS_FILE_H
|
||||
#define JOBS_FILE_H
|
||||
|
||||
#include <reporter.h>
|
||||
#include <bitmaps/bitmaps_list.h>
|
||||
#include <jobs/job.h>
|
||||
#include <jobs/jobs_output.h>
|
||||
#include <settings/json_settings.h>
|
||||
#include <settings/parameters.h>
|
||||
#include <widgets/wx_progress_reporters.h>
|
||||
#include <ctime>
|
||||
#include <memory>
|
||||
|
||||
class REPORTER;
|
||||
|
||||
class JOBSET_OUTPUT_REPORTER : public WX_STRING_REPORTER
|
||||
{
|
||||
public:
|
||||
JOBSET_OUTPUT_REPORTER( const wxString& aTempDirPath, PROGRESS_REPORTER* aProgressReporter ) :
|
||||
m_tempDirPath( aTempDirPath ),
|
||||
m_includeDebug( false ),
|
||||
m_progressReporter( aProgressReporter )
|
||||
{
|
||||
}
|
||||
|
||||
REPORTER& Report( const wxString& aText, SEVERITY aSeverity ) override
|
||||
{
|
||||
wxString text( aText );
|
||||
|
||||
if( aSeverity == RPT_SEVERITY_DEBUG && !m_includeDebug )
|
||||
return *this;
|
||||
|
||||
if( aSeverity == RPT_SEVERITY_ACTION )
|
||||
text.Replace( m_tempDirPath, wxEmptyString );
|
||||
|
||||
if( m_progressReporter )
|
||||
{
|
||||
m_progressReporter->Report( text );
|
||||
m_progressReporter->KeepRefreshing();
|
||||
}
|
||||
|
||||
return WX_STRING_REPORTER::Report( text, aSeverity );
|
||||
}
|
||||
|
||||
private:
|
||||
wxString m_tempDirPath;
|
||||
bool m_includeDebug;
|
||||
PROGRESS_REPORTER* m_progressReporter;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct KICOMMON_API JOBSET_JOB
|
||||
{
|
||||
@ -79,28 +117,26 @@ struct KICOMMON_API JOBSET_DESTINATION
|
||||
|
||||
JOBSET_DESTINATION( const wxString& id, JOBSET_DESTINATION_T type );
|
||||
|
||||
~JOBSET_DESTINATION();
|
||||
|
||||
void InitOutputHandler();
|
||||
|
||||
wxString m_id;
|
||||
JOBSET_DESTINATION_T m_type;
|
||||
wxString m_description;
|
||||
std::shared_ptr<JOBS_OUTPUT_HANDLER> m_outputHandler;
|
||||
std::vector<wxString> m_only;
|
||||
void InitOutputHandler();
|
||||
|
||||
wxString GetDescription() const;
|
||||
void SetDescription( const wxString& aDescription );
|
||||
|
||||
wxString GetPathInfo() const;
|
||||
|
||||
///< Transient property, not stored for now
|
||||
std::optional<bool> m_lastRunSuccess;
|
||||
std::unordered_map<wxString, std::optional<bool>> m_lastRunSuccessMap;
|
||||
std::unordered_map<wxString, REPORTER*> m_lastRunReporters;
|
||||
|
||||
bool operator==( const JOBSET_DESTINATION& rhs ) const;
|
||||
|
||||
public:
|
||||
wxString m_id;
|
||||
JOBSET_DESTINATION_T m_type;
|
||||
wxString m_description;
|
||||
std::shared_ptr<JOBS_OUTPUT_HANDLER> m_outputHandler;
|
||||
std::vector<wxString> m_only;
|
||||
|
||||
///< Transient property, not stored for now
|
||||
std::optional<bool> m_lastRunSuccess;
|
||||
std::unordered_map<wxString, std::optional<bool>> m_lastRunSuccessMap;
|
||||
std::unordered_map<wxString, std::shared_ptr<JOBSET_OUTPUT_REPORTER>> m_lastRunReporters;
|
||||
};
|
||||
|
||||
|
||||
|
@ -148,14 +148,9 @@ public:
|
||||
wxString jobId = jobs[itemIndex].m_id;
|
||||
|
||||
if( m_destination->m_lastRunReporters.contains( jobId ) )
|
||||
{
|
||||
if( auto* reporter = static_cast<WX_STRING_REPORTER*>( m_destination->m_lastRunReporters[jobId] ) )
|
||||
m_textCtrlOutput->SetValue( reporter->GetMessages() );
|
||||
}
|
||||
m_textCtrlOutput->SetValue( m_destination->m_lastRunReporters.at( jobId )->GetMessages() );
|
||||
else
|
||||
{
|
||||
m_textCtrlOutput->SetValue( _( "No output messages" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,42 +134,6 @@ int JOBS_RUNNER::runSpecialCopyFiles( const JOBSET_JOB* aJob, PROJECT* aProject
|
||||
}
|
||||
|
||||
|
||||
class JOBSET_OUTPUT_REPORTER : public WX_STRING_REPORTER
|
||||
{
|
||||
public:
|
||||
JOBSET_OUTPUT_REPORTER( const wxString& aTempDirPath, PROGRESS_REPORTER* aProgressReporter ) :
|
||||
m_tempDirPath( aTempDirPath ),
|
||||
m_includeDebug( false ),
|
||||
m_progressReporter( aProgressReporter )
|
||||
{
|
||||
}
|
||||
|
||||
REPORTER& Report( const wxString& aText, SEVERITY aSeverity ) override
|
||||
{
|
||||
wxString text( aText );
|
||||
|
||||
if( aSeverity == RPT_SEVERITY_DEBUG && !m_includeDebug )
|
||||
return *this;
|
||||
|
||||
if( aSeverity == RPT_SEVERITY_ACTION )
|
||||
text.Replace( m_tempDirPath, wxEmptyString );
|
||||
|
||||
if( m_progressReporter )
|
||||
{
|
||||
m_progressReporter->Report( text );
|
||||
m_progressReporter->KeepRefreshing();
|
||||
}
|
||||
|
||||
return WX_STRING_REPORTER::Report( text, aSeverity );
|
||||
}
|
||||
|
||||
private:
|
||||
wxString m_tempDirPath;
|
||||
bool m_includeDebug;
|
||||
PROGRESS_REPORTER* m_progressReporter;
|
||||
};
|
||||
|
||||
|
||||
bool JOBS_RUNNER::RunJobsForDestination( JOBSET_DESTINATION* aDestination, bool aBail )
|
||||
{
|
||||
bool genOutputs = true;
|
||||
@ -182,10 +146,6 @@ bool JOBS_RUNNER::RunJobsForDestination( JOBSET_DESTINATION* aDestination, bool
|
||||
tmp.AppendDir( KIID().AsString() );
|
||||
|
||||
aDestination->m_lastRunSuccessMap.clear();
|
||||
|
||||
for( auto& [name, reporter] : aDestination->m_lastRunReporters )
|
||||
delete reporter;
|
||||
|
||||
aDestination->m_lastRunReporters.clear();
|
||||
|
||||
wxString tempDirPath = tmp.GetFullPath();
|
||||
@ -270,8 +230,9 @@ bool JOBS_RUNNER::RunJobsForDestination( JOBSET_DESTINATION* aDestination, bool
|
||||
|
||||
if( reporterToUse == &NULL_REPORTER::GetInstance() )
|
||||
{
|
||||
reporterToUse = new JOBSET_OUTPUT_REPORTER( tempDirPath, m_progressReporter );
|
||||
aDestination->m_lastRunReporters[job.m_id] = reporterToUse;
|
||||
aDestination->m_lastRunReporters[job.m_id] = std::make_shared<JOBSET_OUTPUT_REPORTER>( tempDirPath,
|
||||
m_progressReporter );
|
||||
reporterToUse = aDestination->m_lastRunReporters[job.m_id].get();
|
||||
}
|
||||
|
||||
int result = CLI::EXIT_CODES::SUCCESS;
|
||||
|
Loading…
x
Reference in New Issue
Block a user