From dc7e0665c3f05f8e39ff2b8a4f317afc99b540af Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Wed, 3 Sep 2025 16:56:54 -0700 Subject: [PATCH] Prevent GTK from providing stale position When the library name and symbol/footprint name both match the filter, we try to display both but ensure visible can move things to the wrong place. We need to ensure the filtered list is up to date prior to moving by ensureVisible Fixes https://gitlab.com/kicad/code/kicad/-/issues/18000 --- common/lib_tree_model_adapter.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/lib_tree_model_adapter.cpp b/common/lib_tree_model_adapter.cpp index 6ce110aa24..244935e034 100644 --- a/common/lib_tree_model_adapter.cpp +++ b/common/lib_tree_model_adapter.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include @@ -308,6 +309,15 @@ void LIB_TREE_MODEL_ADAPTER::UpdateSearchString( const wxString& aSearch, bool a const LIB_TREE_NODE* firstMatch = ShowResults(); +#ifdef __WXGTK__ + // Ensure the control is repainted with the updated data. Without an explicit + // refresh the Gtk port can display stale rows until the user interacts with + // them, leading to mismatched tree contents. + m_widget->Refresh(); + m_widget->Update(); + wxYield(); +#endif + if( firstMatch ) { wxDataViewItem item = ToItem( firstMatch );