mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 09:41:41 +00:00
Prevent crash when importing over existing project
If the hierarchy navigator is open and expanded, we have references to the existing sheets. These need to be cleared when importing a new sheet over top Fixes https://gitlab.com/kicad/code/kicad/-/issues/20004
This commit is contained in:
parent
ac9f41baaa
commit
2e93fb7a24
@ -578,7 +578,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
||||
|
||||
TestDanglingEnds();
|
||||
|
||||
UpdateHierarchyNavigator( false );
|
||||
UpdateHierarchyNavigator( false, true );
|
||||
|
||||
wxCommandEvent changedEvt( EDA_EVT_SCHEMATIC_CHANGED );
|
||||
ProcessEventLocally( changedEvt );
|
||||
@ -1424,7 +1424,7 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType,
|
||||
SetSheetNumberAndCount();
|
||||
SyncView();
|
||||
|
||||
UpdateHierarchyNavigator();
|
||||
UpdateHierarchyNavigator( false, true );
|
||||
|
||||
wxCommandEvent e( EDA_EVT_SCHEMATIC_CHANGED );
|
||||
ProcessEventLocally( e );
|
||||
|
@ -1229,10 +1229,10 @@ void SCH_EDIT_FRAME::OnUpdatePCB()
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::UpdateHierarchyNavigator( bool aRefreshNetNavigator )
|
||||
void SCH_EDIT_FRAME::UpdateHierarchyNavigator( bool aRefreshNetNavigator, bool aClear )
|
||||
{
|
||||
m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->CleanHistory();
|
||||
m_hierarchy->UpdateHierarchyTree();
|
||||
m_hierarchy->UpdateHierarchyTree( aClear );
|
||||
|
||||
if( aRefreshNetNavigator )
|
||||
RefreshNetNavigator();
|
||||
|
@ -244,7 +244,7 @@ public:
|
||||
/**
|
||||
* Update the hierarchy navigation tree and history
|
||||
*/
|
||||
void UpdateHierarchyNavigator( bool aRefreshNetNavigator = true );
|
||||
void UpdateHierarchyNavigator( bool aRefreshNetNavigator = true, bool aClear = false );
|
||||
|
||||
/**
|
||||
* Update the hierarchy navigation tree labels.
|
||||
|
@ -209,7 +209,7 @@ void HIERARCHY_PANE::UpdateHierarchySelection()
|
||||
}
|
||||
|
||||
|
||||
void HIERARCHY_PANE::UpdateHierarchyTree()
|
||||
void HIERARCHY_PANE::UpdateHierarchyTree( bool aClear )
|
||||
{
|
||||
Freeze();
|
||||
|
||||
@ -248,7 +248,9 @@ void HIERARCHY_PANE::UpdateHierarchyTree()
|
||||
}
|
||||
};
|
||||
|
||||
if( !m_tree->IsEmpty() )
|
||||
// If we are clearing the tree, don't try to get expanded nodes as they
|
||||
// might be deleted
|
||||
if( !aClear && !m_tree->IsEmpty() )
|
||||
getExpandedNodes( m_tree->GetRootItem() );
|
||||
|
||||
m_list.clear();
|
||||
|
@ -84,7 +84,7 @@ public:
|
||||
/**
|
||||
* Update the hierarchical tree of the schematic.
|
||||
*/
|
||||
void UpdateHierarchyTree();
|
||||
void UpdateHierarchyTree( bool aClear = false );
|
||||
|
||||
/**
|
||||
* Updates the tree's selection to match current page
|
||||
|
Loading…
Reference in New Issue
Block a user