Repair recent pass-by-reference cleanup.

Fixes https://gitlab.com/kicad/code/kicad/issues/8576
This commit is contained in:
Jeff Young 2021-06-09 10:47:14 +01:00
parent fad5f9881a
commit 9411d301a0
5 changed files with 12 additions and 13 deletions

View File

@ -88,7 +88,7 @@ DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aI
m_drawingSheet = new DS_DATA_MODEL;
wxString serialization;
DS_DATA_MODEL::GetTheInstance().SaveInString( serialization );
DS_DATA_MODEL::GetTheInstance().SaveInString( &serialization );
m_drawingSheet->SetPageLayout( TO_UTF8( serialization ) );
m_PickDate->SetValue( wxDateTime::Now() );

View File

@ -106,7 +106,7 @@ private:
class DS_DATA_MODEL_STRINGIO : public DS_DATA_MODEL_IO
{
public:
DS_DATA_MODEL_STRINGIO( const wxString& aOutputString ) :
DS_DATA_MODEL_STRINGIO( wxString* aOutputString ) :
DS_DATA_MODEL_IO(),
m_output( aOutputString )
{
@ -123,13 +123,13 @@ public:
~DS_DATA_MODEL_STRINGIO()
{
m_output = FROM_UTF8( m_writer->GetString().c_str() );
*m_output = FROM_UTF8( m_writer->GetString().c_str() );
delete m_writer;
}
private:
STRING_FORMATTER* m_writer;
wxString m_output;
wxString* m_output;
};
@ -140,15 +140,14 @@ void DS_DATA_MODEL::Save( const wxString& aFullFileName )
}
void DS_DATA_MODEL::SaveInString( const wxString& aOutputString )
void DS_DATA_MODEL::SaveInString( wxString* aOutputString )
{
DS_DATA_MODEL_STRINGIO writer( aOutputString );
writer.Format( this );
}
void DS_DATA_MODEL::SaveInString( std::vector<DS_DATA_ITEM*>& aItemsList,
const wxString& aOutputString )
void DS_DATA_MODEL::SaveInString( std::vector<DS_DATA_ITEM*>& aItemsList, wxString* aOutputString )
{
DS_DATA_MODEL_STRINGIO writer( aOutputString );

View File

@ -42,7 +42,7 @@ DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM( const EDA_DRAW_FRAME* aFrame ) :
}
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
model.SaveInString( m_layoutSerialization );
model.SaveInString( &m_layoutSerialization );
for( size_t ii = 0; ii < model.GetItems().size(); ++ii )
{

View File

@ -101,12 +101,12 @@ public:
*
* @param aOutputString is a wxString to store the S expr string
*/
void SaveInString( const wxString& aOutputString );
void SaveInString( wxString* aOutputString );
/**
* Fill the given string with an S-expr serialization of the WS_DATA_ITEMs.
*/
void SaveInString( std::vector<DS_DATA_ITEM*>& aItemsList, const wxString& aOutputString );
void SaveInString( std::vector<DS_DATA_ITEM*>& aItemsList, wxString* aOutputString );
void Append( DS_DATA_ITEM* aItem );
void Remove( DS_DATA_ITEM* aItem );

View File

@ -467,7 +467,7 @@ int PL_EDIT_TOOL::Copy( const TOOL_EVENT& aEvent )
try
{
model.SaveInString( items, sexpr );
model.SaveInString( items, &sexpr );
}
catch( const IO_ERROR& ioe )
{