From 5bb06e5ac52faa1ede1d721a8fcc6ff700cf5137 Mon Sep 17 00:00:00 2001 From: Tomasz Wlostowski Date: Wed, 6 Mar 2019 14:01:40 +0100 Subject: [PATCH] pcbnew: can't return a copy of ptr_vector if items are polymorphic and have no clone() methods. Work it around. --- pcbnew/pcb_edit_frame.h | 3 ++- pcbnew/pcbnew_config.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index 96feb5440e..0018b91e09 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -93,6 +93,7 @@ protected: PCB_LAYER_WIDGET* m_Layers; PARAM_CFG_ARRAY m_configParams; ///< List of Pcbnew configuration settings. + PARAM_CFG_ARRAY m_projectFileParams; wxString m_lastNetListRead; ///< Last net list read with relative path. @@ -380,7 +381,7 @@ public: * @return PARAM_CFG_ARRAY - it is only good until SetBoard() is called, so * don't keep it around past that event. */ - PARAM_CFG_ARRAY GetProjectFileParameters(); + PARAM_CFG_ARRAY& GetProjectFileParameters(); /** * Function SaveProjectSettings diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index ff1cb57420..8b577538ef 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -125,21 +125,21 @@ void PCB_EDIT_FRAME::SaveProjectSettings( bool aAskForSave ) } -PARAM_CFG_ARRAY PCB_EDIT_FRAME::GetProjectFileParameters() +PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetProjectFileParameters() { - PARAM_CFG_ARRAY pca; + m_projectFileParams.clear(); // This one cannot be cached because some settings are going to/from the BOARD, // so pointers into that cannot be saved for long. - pca.push_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ), + m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ), &BASE_SCREEN::m_PageLayoutDescrFileName ) ); - pca.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ), &m_lastNetListRead ) ); + m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ), &m_lastNetListRead ) ); - GetBoard()->GetDesignSettings().AppendConfigs( GetBoard(), &pca ); + GetBoard()->GetDesignSettings().AppendConfigs( GetBoard(), &m_projectFileParams); - return pca; + return m_projectFileParams; }