Browse Source

eeschema: fix crash when closing simulation frame

Destructor of SIM_PLOT_FRAME calls sim->Attach( nullptr ) in order to destroy
circuit model (former netlist exporter). If this is skipped, eeschema crashes
when program is closed. nullptr is a valid parameter for Attach()
7.0
Sylwester Kocjan 4 years ago
committed by Mikolaj Wielgus
parent
commit
a9c61d21ca
  1. 3
      eeschema/sim/ngspice.cpp

3
eeschema/sim/ngspice.cpp

@ -258,10 +258,9 @@ vector<double> NGSPICE::GetPhasePlot( const string& aName, int aMaxLen )
bool NGSPICE::Attach( const std::shared_ptr<SIMULATION_MODEL>& aModel )
{
NGSPICE_CIRCUIT_MODEL* model = dynamic_cast<NGSPICE_CIRCUIT_MODEL*>( aModel.get() );
wxASSERT( model != nullptr );
STRING_FORMATTER formatter;
if( model->GetNetlist( &formatter ) )
if( model && model->GetNetlist( &formatter ) )
{
SIMULATOR::Attach( aModel );

Loading…
Cancel
Save