Event safety.
Sentry crash probably happens when an update title event fires either too early or too late to have a simulator or simulator settings. Sentry issue https://sentry.io/organizations/kicad/issues/3669444623/events/fce0179f7d5e4ff3a7dbb0d90a0570b4/
This commit is contained in:
parent
424cdf6699
commit
80f3abe082
|
@ -322,22 +322,25 @@ void SIM_PLOT_FRAME::initWorkbook()
|
||||||
|
|
||||||
void SIM_PLOT_FRAME::updateTitle()
|
void SIM_PLOT_FRAME::updateTitle()
|
||||||
{
|
{
|
||||||
wxFileName filename = Prj().AbsolutePath( m_simulator->Settings()->GetWorkbookFilename() );
|
bool unsaved = true;
|
||||||
|
bool readOnly = false;
|
||||||
bool readOnly = false;
|
|
||||||
bool unsaved = false;
|
|
||||||
|
|
||||||
if( filename.IsOk() && filename.FileExists() )
|
|
||||||
readOnly = !filename.IsFileWritable();
|
|
||||||
else
|
|
||||||
unsaved = true;
|
|
||||||
|
|
||||||
wxString title;
|
wxString title;
|
||||||
|
|
||||||
if( m_workbook->IsModified() )
|
if( m_simulator && m_simulator->Settings() )
|
||||||
title = wxT( "*" ) + filename.GetName();
|
{
|
||||||
else
|
wxFileName filename = Prj().AbsolutePath( m_simulator->Settings()->GetWorkbookFilename() );
|
||||||
title = filename.GetName();
|
|
||||||
|
if( filename.IsOk() && filename.FileExists() )
|
||||||
|
{
|
||||||
|
unsaved = false;
|
||||||
|
readOnly = !filename.IsFileWritable();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_workbook->IsModified() )
|
||||||
|
title = wxT( "*" ) + filename.GetName();
|
||||||
|
else
|
||||||
|
title = filename.GetName();
|
||||||
|
}
|
||||||
|
|
||||||
if( readOnly )
|
if( readOnly )
|
||||||
title += wxS( " " ) + _( "[Read Only]" );
|
title += wxS( " " ) + _( "[Read Only]" );
|
||||||
|
|
Loading…
Reference in New Issue