Give a timeslice to show Save Changes? dialog before things get ugly.
This also moves closing the existing project earlier to improve the workflow -- so there's a chance that the main fix might not be needed anymore, but it's still safer to not have a control-flow that crashes rather than to just not use that control-flow. Fixes https://gitlab.com/kicad/code/kicad/issues/9200
This commit is contained in:
parent
65c9170b46
commit
23c76cccf3
|
@ -66,6 +66,11 @@ void KICAD_MANAGER_FRAME::ImportNonKiCadProject( const wxString& aWindowTitle,
|
||||||
if( schdlg.ShowModal() == wxID_CANCEL )
|
if( schdlg.ShowModal() == wxID_CANCEL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// OK, we got a new project to open. Time to close any existing project before we go on
|
||||||
|
// to collect info about where to put the new one, etc. Otherwise the workflow is kind of
|
||||||
|
// disjoint.
|
||||||
|
CloseProject( true );
|
||||||
|
|
||||||
wxFileName sch( schdlg.GetPath() );
|
wxFileName sch( schdlg.GetPath() );
|
||||||
sch.SetExt( aSchFileExtension );
|
sch.SetExt( aSchFileExtension );
|
||||||
|
|
||||||
|
@ -171,8 +176,6 @@ void KICAD_MANAGER_FRAME::ImportNonKiCadProject( const wxString& aWindowTitle,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the project and make the new one
|
|
||||||
CloseProject( true );
|
|
||||||
CreateNewProject( pro.GetFullPath(), false /* Don't create stub files */ );
|
CreateNewProject( pro.GetFullPath(), false /* Don't create stub files */ );
|
||||||
LoadProject( pro );
|
LoadProject( pro );
|
||||||
|
|
||||||
|
|
|
@ -411,6 +411,9 @@ bool KICAD_MANAGER_FRAME::CloseProject( bool aSave )
|
||||||
if( !Kiway().PlayersClose( false ) )
|
if( !Kiway().PlayersClose( false ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// Give a timeslice for the save-changes? dialog (and for the project to actually close)
|
||||||
|
wxSafeYield();
|
||||||
|
|
||||||
// Save the project file for the currently loaded project.
|
// Save the project file for the currently loaded project.
|
||||||
if( m_active_project )
|
if( m_active_project )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue