Make sure nested settings get released in dtor

Also fix a crash if sim window can't be created because
ngspice shared library could not be found

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7969
This commit is contained in:
Jon Evans 2021-03-19 19:04:27 -04:00
parent 61c9645220
commit 4b46c0c954
2 changed files with 7 additions and 0 deletions

View File

@ -217,6 +217,9 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
SCHEMATIC_SETTINGS::~SCHEMATIC_SETTINGS()
{
ReleaseNestedSettings( m_NgspiceSimulatorSettings.get() );
m_NgspiceSimulatorSettings.reset();
if( m_parent )
{
m_parent->ReleaseNestedSettings( this );

View File

@ -442,6 +442,10 @@ int EE_INSPECTION_TOOL::RunSimulation( const TOOL_EVENT& aEvent )
{
#ifdef KICAD_SPICE
SIM_PLOT_FRAME* simFrame = (SIM_PLOT_FRAME*) m_frame->Kiway().Player( FRAME_SIMULATOR, true );
if( !simFrame )
return -1;
simFrame->Show( true );
// On Windows, Raise() does not bring the window on screen, when iconized