diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 8a12d4a1ae..c439b15fca 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -680,6 +681,9 @@ void SCH_EDIT_FRAME::doCloseWindow() if( FindHierarchyNavigator() ) FindHierarchyNavigator()->Close( true ); + if( Kiway().Player( FRAME_SIMULATOR, false ) ) + Prj().GetProjectFile().m_SchematicSettings->m_NgspiceSimulatorSettings->SaveToFile(); + SCH_SCREENS screens( Schematic().Root() ); wxFileName fn; diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp index 258f316aeb..d7e9f566f7 100644 --- a/eeschema/sim/sim_plot_frame.cpp +++ b/eeschema/sim/sim_plot_frame.cpp @@ -274,12 +274,15 @@ void SIM_PLOT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) cfg->m_Simulator.white_background = m_plotUseWhiteBg; } - if( m_schematicFrame ) + if( !m_isNonUserClose ) // If we're exiting the project has already been released. { PROJECT_FILE& project = Prj().GetProjectFile(); - project.m_SchematicSettings->m_NgspiceSimulatorSettings->SaveToFile(); - m_schematicFrame->SaveProjectSettings(); + if( project.m_SchematicSettings ) + project.m_SchematicSettings->m_NgspiceSimulatorSettings->SaveToFile(); + + if( m_schematicFrame ) + m_schematicFrame->SaveProjectSettings(); } }