Eeschema: fix a crash on closing the schematic editor if the point editor is active.

If the point editor is active and a change is made, the tool was shut down after
deleting the board data, in the frame Dtor.
Therefore a crash happened because a call to GetScreen()->SetModify(); using a null pointer,
and after the test for modifications was done.
Now tools are stopped when closing the window, before any test for modifications.
This commit is contained in:
jean-pierre charras 2020-02-07 10:02:47 +01:00
parent 469c1c14ef
commit b0367f5a34
1 changed files with 9 additions and 0 deletions

View File

@ -516,6 +516,10 @@ void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
return;
}
// Shutdown all running tools ( and commit any pending change )
if( m_toolManager )
m_toolManager->ShutdownAllTools();
if( Kiface().IsSingle() )
{
LIB_EDIT_FRAME* libeditFrame = (LIB_EDIT_FRAME*) Kiway().Player( FRAME_SCH_LIB_EDITOR, false );
@ -621,6 +625,11 @@ wxString SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet()
void SCH_EDIT_FRAME::OnModify()
{
wxASSERT( GetScreen() );
if( !GetScreen() )
return;
GetScreen()->SetModify();
GetScreen()->SetSave();