From 0f6f30b26e22b852c951f57c4d1b360adfbb08a1 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 20 Apr 2021 11:44:37 -0700 Subject: [PATCH] Ensure collapsed tree before update We had been maintaining the tree collapse state for "clear" actions where the user went back to no object search. This was helpful in the case where we had previous items (e.g. last placed element) But this causes isses when a sub element was previously select on GTK. Now we choose safety for GTK over the pretty display Fixes https://gitlab.com/kicad/code/kicad/issues/8198 --- common/lib_tree_model_adapter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib_tree_model_adapter.cpp b/common/lib_tree_model_adapter.cpp index f4deb1dbf6..e9d673d704 100644 --- a/common/lib_tree_model_adapter.cpp +++ b/common/lib_tree_model_adapter.cpp @@ -155,7 +155,7 @@ void LIB_TREE_MODEL_ADAPTER::UpdateSearchString( wxString const& aSearch, bool a // Also note that this cannot happen when we have deleted a symbol as GTK will also // iterate over the tree in this case and find a symbol that has an invalid link // and crash https://gitlab.com/kicad/code/kicad/-/issues/6910 - if( !aState && !aSearch.IsNull() && m_tree.Children.size() ) + if( !aState && m_tree.Children.size() ) { for( std::unique_ptr& child: m_tree.Children ) m_widget->Collapse( wxDataViewItem( &*child ) );