pcbnew: can't return a copy of ptr_vector if items are polymorphic and have no clone() methods. Work it around.

This commit is contained in:
Tomasz Wlostowski 2019-03-06 14:01:40 +01:00 committed by Wayne Stambaugh
parent 6cd7d9fb89
commit 5bb06e5ac5
2 changed files with 8 additions and 7 deletions

View File

@ -93,6 +93,7 @@ protected:
PCB_LAYER_WIDGET* m_Layers; PCB_LAYER_WIDGET* m_Layers;
PARAM_CFG_ARRAY m_configParams; ///< List of Pcbnew configuration settings. 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. 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 * @return PARAM_CFG_ARRAY - it is only good until SetBoard() is called, so
* don't keep it around past that event. * don't keep it around past that event.
*/ */
PARAM_CFG_ARRAY GetProjectFileParameters(); PARAM_CFG_ARRAY& GetProjectFileParameters();
/** /**
* Function SaveProjectSettings * Function SaveProjectSettings

View File

@ -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, // This one cannot be cached because some settings are going to/from the BOARD,
// so pointers into that cannot be saved for long. // 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 ) ); &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;
} }