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()
|
||||
{
|
||||
wxFileName filename = Prj().AbsolutePath( m_simulator->Settings()->GetWorkbookFilename() );
|
||||
|
||||
bool readOnly = false;
|
||||
bool unsaved = false;
|
||||
|
||||
if( filename.IsOk() && filename.FileExists() )
|
||||
readOnly = !filename.IsFileWritable();
|
||||
else
|
||||
unsaved = true;
|
||||
|
||||
bool unsaved = true;
|
||||
bool readOnly = false;
|
||||
wxString title;
|
||||
|
||||
if( m_workbook->IsModified() )
|
||||
title = wxT( "*" ) + filename.GetName();
|
||||
else
|
||||
title = filename.GetName();
|
||||
if( m_simulator && m_simulator->Settings() )
|
||||
{
|
||||
wxFileName filename = Prj().AbsolutePath( m_simulator->Settings()->GetWorkbookFilename() );
|
||||
|
||||
if( filename.IsOk() && filename.FileExists() )
|
||||
{
|
||||
unsaved = false;
|
||||
readOnly = !filename.IsFileWritable();
|
||||
}
|
||||
|
||||
if( m_workbook->IsModified() )
|
||||
title = wxT( "*" ) + filename.GetName();
|
||||
else
|
||||
title = filename.GetName();
|
||||
}
|
||||
|
||||
if( readOnly )
|
||||
title += wxS( " " ) + _( "[Read Only]" );
|
||||
|
|
Loading…
Reference in New Issue