From b1f613071dc5ebc649c46e69fc1cf0c0ac2ef410 Mon Sep 17 00:00:00 2001 From: Tomasz Wlostowski Date: Mon, 12 Mar 2018 14:27:45 +0100 Subject: [PATCH] eeschema: workaround for 64kByte string length limit in wxString::Format() causing segfaults in netlist update under Windows Fixes: lp:1754402 * https://bugs.launchpad.net/kicad/+bug/1754402 --- common/kiway.cpp | 2 +- eeschema/sch_edit_frame.cpp | 9 ++++----- include/kiway.h | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/common/kiway.cpp b/common/kiway.cpp index c099f516e0..5d6f7e476b 100644 --- a/common/kiway.cpp +++ b/common/kiway.cpp @@ -384,7 +384,7 @@ bool KIWAY::PlayersClose( bool doForce ) void KIWAY::ExpressMail( FRAME_T aDestination, - MAIL_T aCommand, const std::string& aPayload, wxWindow* aSource ) + MAIL_T aCommand, std::string aPayload, wxWindow* aSource ) { KIWAY_EXPRESS mail( aDestination, aCommand, aPayload, aSource ); diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 9eeb2d7ee8..01064a0e42 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -907,13 +907,12 @@ void SCH_EDIT_FRAME::doUpdatePcb( const wxString& aUpdateOptions ) exporter.Format( &formatter, GNL_ALL ); - // Copy the netlist in a static string, to have a long life time - // and giving to Pcbnew the time to analyze this netlist: - static std::string netlist_string; - netlist_string = wxString::Format("%s\n%s", aUpdateOptions, formatter.GetString() ).ToStdString(); + auto updateOptions = aUpdateOptions.ToStdString(); + auto netlistString = formatter.GetString(); + auto finalNetlist = updateOptions + "\n" + netlistString; // Now, send the "kicad" (s-expr) netlist to Pcbnew - Kiway().ExpressMail( FRAME_PCB, MAIL_SCH_PCB_UPDATE, netlist_string, this ); + Kiway().ExpressMail( FRAME_PCB, MAIL_SCH_PCB_UPDATE, finalNetlist, this ); } diff --git a/include/kiway.h b/include/kiway.h index 9b668ecfc6..fd58d912ca 100644 --- a/include/kiway.h +++ b/include/kiway.h @@ -344,7 +344,7 @@ public: * aCommand in there. */ VTBL_ENTRY void ExpressMail( FRAME_T aDestination, MAIL_T aCommand, - const std::string& aPayload, wxWindow* aSource = NULL ); + std::string aPayload, wxWindow* aSource = NULL ); /** * Function Prj