From 5c4313587b46c3380f45be21bc19fc4de10eacaf Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 20 Jan 2024 19:25:03 +0000 Subject: [PATCH] Attempt to fix hierarchy tree selection issue. Fixes https://gitlab.com/kicad/code/kicad/-/issues/16670 --- eeschema/widgets/hierarchy_pane.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/eeschema/widgets/hierarchy_pane.cpp b/eeschema/widgets/hierarchy_pane.cpp index 8919d61bac..e2ed47e3a0 100644 --- a/eeschema/widgets/hierarchy_pane.cpp +++ b/eeschema/widgets/hierarchy_pane.cpp @@ -247,8 +247,15 @@ void HIERARCHY_PANE::UpdateHierarchyTree() void HIERARCHY_PANE::onSelectSheetPath( wxTreeEvent& aEvent ) { wxTreeItemId itemSel = m_tree->GetSelection(); + + if( !itemSel.IsOk() ) + return; + TREE_ITEM_DATA* itemData = static_cast( m_tree->GetItemData( itemSel ) ); + if( !itemData ) + return; + SetCursor( wxCURSOR_ARROWWAIT ); m_frame->GetToolManager()->RunAction( EE_ACTIONS::changeSheet, &itemData->m_SheetPath ); @@ -258,7 +265,7 @@ void HIERARCHY_PANE::onSelectSheetPath( wxTreeEvent& aEvent ) void HIERARCHY_PANE::onRightClick( wxTreeEvent& aEvent ) { - wxTreeItemId itemSel = m_tree->GetFocusedItem(); + wxTreeItemId itemSel = m_tree->GetSelection(); if( !itemSel.IsOk() ) return;