mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Prevent crash on failure to load ngspice's dll
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20695 (cherry picked from commit f35078cb293e44c81dfbf8563f01cfac4248e09a) Co-authored-by: Marek Roszko <mark.roszko@gmail.com>
This commit is contained in:
parent
280031f6e0
commit
f3d445efc9
@ -452,8 +452,9 @@ KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate, wxTopLevelWindow
|
||||
m_ctl // questionable need, these same flags
|
||||
// were passed to KIFACE::OnKifaceStart()
|
||||
);
|
||||
if( frame )
|
||||
m_playerFrameId[aFrameType].store( frame->GetId() );
|
||||
|
||||
m_playerFrameId[aFrameType].store( frame->GetId() );
|
||||
return frame;
|
||||
}
|
||||
catch( ... )
|
||||
|
@ -191,8 +191,17 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
|
||||
|
||||
case FRAME_SIMULATOR:
|
||||
{
|
||||
SIMULATOR_FRAME* frame = new SIMULATOR_FRAME( aKiway, aParent );
|
||||
return frame;
|
||||
try
|
||||
{
|
||||
SIMULATOR_FRAME* frame = new SIMULATOR_FRAME( aKiway, aParent );
|
||||
return frame;
|
||||
}
|
||||
catch( SIMULATOR_INIT_ERR )
|
||||
{
|
||||
// catch the init err exception as we don't want it to bubble up
|
||||
// its going to be some ngspice install issue but we don't want to log that
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
case FRAME_SCH_VIEWER:
|
||||
|
@ -498,7 +498,7 @@ void NGSPICE::init_dll()
|
||||
#endif
|
||||
|
||||
if( !m_dll.IsLoaded() )
|
||||
throw std::runtime_error( "Missing ngspice shared library" );
|
||||
throw std::runtime_error( _( "Unable to load ngspice shared library. Please check your install." ).ToStdString() );
|
||||
|
||||
m_error = false;
|
||||
|
||||
|
@ -145,7 +145,9 @@ SIMULATOR_FRAME::SIMULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
mainSizer->Add( m_ui, 1, wxEXPAND, 5 );
|
||||
|
||||
m_simulator = SIMULATOR::CreateInstance( "ngspice" );
|
||||
wxASSERT( m_simulator );
|
||||
|
||||
if( !m_simulator )
|
||||
throw SIMULATOR_INIT_ERR( "Failed to create simulator instance" );
|
||||
|
||||
LoadSettings( config() );
|
||||
|
||||
|
@ -49,6 +49,18 @@ class ACTION_TOOLBAR;
|
||||
class SPICE_SIMULATOR;
|
||||
|
||||
|
||||
/**
|
||||
* Simple error container for failure to init the simulation engine
|
||||
* and ultimately abort the frame construction
|
||||
*/
|
||||
class SIMULATOR_INIT_ERR : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit SIMULATOR_INIT_ERR(const std::string& what_arg)
|
||||
: std::runtime_error(what_arg) {}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* The SIMULATOR_FRAME holds the main user-interface for running simulations.
|
||||
|
Loading…
x
Reference in New Issue
Block a user