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
This commit is contained in:
Seth Hillbrand 2021-04-20 11:44:37 -07:00
parent 8219334806
commit 0f6f30b26e
1 changed files with 1 additions and 1 deletions

View File

@ -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<LIB_TREE_NODE>& child: m_tree.Children )
m_widget->Collapse( wxDataViewItem( &*child ) );