From 25d794b40586e211f9d643294be6387bdf232c42 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 3 Jan 2025 13:32:07 +0000 Subject: [PATCH] Read old job output specs with no ids. --- common/jobs/jobset.cpp | 18 +++++++++++------- common/jobs/jobset.h | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/common/jobs/jobset.cpp b/common/jobs/jobset.cpp index c35ba9e8c4..1f526931b2 100644 --- a/common/jobs/jobset.cpp +++ b/common/jobs/jobset.cpp @@ -84,12 +84,17 @@ KICOMMON_API void to_json( nlohmann::json& j, const JOBSET_OUTPUT& f ) KICOMMON_API void from_json( const nlohmann::json& j, JOBSET_OUTPUT& f ) { - j.at( "id" ).get_to( f.m_id ); + // During 9.0 development outputs didn't get ids. + if( j.contains( "id" ) ) + j.at( "id" ).get_to( f.m_id ); + else + f.m_id = KIID().AsString(); + j.at( "type" ).get_to( f.m_type ); f.m_only = j.value( "only", std::vector() ); f.m_description = j.value( "description", "" ); - nlohmann::json settings_obj = j.at( "settings" ); + const nlohmann::json& settings_obj = j.at( "settings" ); f.InitOutputHandler(); @@ -109,7 +114,7 @@ JOBSET_OUTPUT::JOBSET_OUTPUT() : } -JOBSET_OUTPUT::JOBSET_OUTPUT( wxString id, JOBSET_OUTPUT_TYPE type ) : +JOBSET_OUTPUT::JOBSET_OUTPUT( const wxString& id, JOBSET_OUTPUT_TYPE type ) : m_id( id ), m_type( type ), m_outputHandler( nullptr ), @@ -122,10 +127,9 @@ JOBSET_OUTPUT::JOBSET_OUTPUT( wxString id, JOBSET_OUTPUT_TYPE type ) : JOBSET_OUTPUT::~JOBSET_OUTPUT() { - for( auto& reporter : m_lastRunReporters ) - { - delete reporter.second; - } + for( auto& [name, reporter] : m_lastRunReporters ) + delete reporter; + m_lastRunReporters.clear(); } diff --git a/common/jobs/jobset.h b/common/jobs/jobset.h index cd5242223e..dc0424f110 100644 --- a/common/jobs/jobset.h +++ b/common/jobs/jobset.h @@ -57,7 +57,7 @@ struct KICOMMON_API JOBSET_OUTPUT { JOBSET_OUTPUT(); - JOBSET_OUTPUT( wxString id, JOBSET_OUTPUT_TYPE type ); + JOBSET_OUTPUT( const wxString& id, JOBSET_OUTPUT_TYPE type ); ~JOBSET_OUTPUT();