Don't leave dangling pointers to old document when importing.
This goes for both selection pointers and undo/redo pointers. Fixes https://gitlab.com/kicad/code/kicad/issues/10145
This commit is contained in:
parent
3271b43d4b
commit
535ecb9b7b
|
@ -632,6 +632,10 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent )
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Don't leave dangling pointers to previously-opened document.
|
||||||
|
m_toolManager->GetTool<EE_SELECTION_TOOL>()->ClearSelection();
|
||||||
|
ClearUndoRedoList();
|
||||||
|
|
||||||
if( setProject )
|
if( setProject )
|
||||||
{
|
{
|
||||||
Schematic().SetProject( nullptr );
|
Schematic().SetProject( nullptr );
|
||||||
|
@ -665,8 +669,6 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_toolManager->GetTool<EE_SELECTION_TOOL>()->ClearSelection();
|
|
||||||
|
|
||||||
importFile( dlg.GetPath(), pluginType );
|
importFile( dlg.GetPath(), pluginType );
|
||||||
|
|
||||||
RefreshCanvas();
|
RefreshCanvas();
|
||||||
|
|
Loading…
Reference in New Issue