kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #41282
[PATCH 1/9] 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 705f5f7f4..dadb6cba0 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.
@@ -379,7 +380,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 ff1cb5742..8b577538e 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;
}
References