From 69e4231303f0604263621cbe4b1264ea4eebfe1b Mon Sep 17 00:00:00 2001 From: jp-charras Date: Mon, 29 Aug 2016 19:47:08 +0200 Subject: [PATCH] Sch editor and Simulator: close the simulator frame when the schematic editor is closed, to avoid crash, due to the fact the simulator can try to access to a no more existing frame.. --- eeschema/schframe.cpp | 6 ++++++ pcbnew/specctra.cpp | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 344342fb1c..618083c768 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -52,6 +52,7 @@ #include #include #include +#include "sim/sim_plot_frame.h" #include #include @@ -623,6 +624,11 @@ void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent ) return; } + SIM_PLOT_FRAME* simFrame = (SIM_PLOT_FRAME*) Kiway().Player( FRAME_SIMULATOR, false ); + + if( simFrame && !simFrame->Close() ) // Can close the simulator? + return; + SCH_SHEET_LIST sheetList( g_RootSheet ); if( sheetList.IsModified() ) diff --git a/pcbnew/specctra.cpp b/pcbnew/specctra.cpp index 39ffb905e6..b9a304dcf9 100644 --- a/pcbnew/specctra.cpp +++ b/pcbnew/specctra.cpp @@ -3749,7 +3749,7 @@ void PLACE::Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IO_ERROR ) if( part_number.size() ) { - const char* quote = out->GetQuoteChar( part_number.c_str() ); + quote = out->GetQuoteChar( part_number.c_str() ); out->Print( nestLevel+1, "(PN %s%s%s)\n", quote, part_number.c_str(), quote ); } @@ -3764,7 +3764,7 @@ void PLACE::Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IO_ERROR ) if( part_number.size() ) { - const char* quote = out->GetQuoteChar( part_number.c_str() ); + quote = out->GetQuoteChar( part_number.c_str() ); out->Print( 0, "%s(PN %s%s%s)", space, quote, part_number.c_str(), quote ); }