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