From 1143df89b124c2f7d90e979d783b3915a1d6b665 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 6 Jan 2026 15:43:13 -0800 Subject: [PATCH] Fix database library symbols disappearing in symbol chooser The GetLibraryStatus() check was only verifying that the optional had a value, not that the library was actually loaded. Database libraries return a status even when not fully loaded, causing them to be skipped during tree population. Check both that the status exists AND that load_status is LOADED before considering a library as ready for display. Additionally, we need to clear the HTML placeholders when loading fails to prevent them leaking Fixes https://gitlab.com/kicad/code/kicad/-/issues/16667 --- eeschema/generate_alias_info.cpp | 17 +++++++++++++++++ eeschema/symbol_tree_model_adapter.cpp | 4 +++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/eeschema/generate_alias_info.cpp b/eeschema/generate_alias_info.cpp index a99cc5a3a8..66b14824bb 100644 --- a/eeschema/generate_alias_info.cpp +++ b/eeschema/generate_alias_info.cpp @@ -66,7 +66,10 @@ public: wxCHECK_RET( m_libs, "Symbol library manager adapter pointer is not valid" ); if( !m_lib_id.IsValid() ) + { + ClearPlaceholders(); return; + } try { @@ -78,6 +81,7 @@ public: m_lib_id.GetLibItemName().wx_str(), m_lib_id.GetLibNickname().wx_str(), ioe.What() ); + ClearPlaceholders(); return; } @@ -89,6 +93,10 @@ public: SetHtmlKeywords(); SetHtmlFieldTable(); } + else + { + ClearPlaceholders(); + } } /** @@ -253,6 +261,15 @@ protected: m_html.Replace( wxS( "__FIELDS__" ), fieldtable ); } + void ClearPlaceholders() + { + m_html.Replace( wxS( "__NAME__" ), wxEmptyString ); + m_html.Replace( wxS( "__ALIASOF__" ), wxEmptyString ); + m_html.Replace( wxS( "__DESC__" ), wxEmptyString ); + m_html.Replace( wxS( "__KEY__" ), wxEmptyString ); + m_html.Replace( wxS( "__FIELDS__" ), wxEmptyString ); + } + private: wxString m_html; SYMBOL_LIBRARY_ADAPTER* m_libs; diff --git a/eeschema/symbol_tree_model_adapter.cpp b/eeschema/symbol_tree_model_adapter.cpp index 367961c31a..139ffa6322 100644 --- a/eeschema/symbol_tree_model_adapter.cpp +++ b/eeschema/symbol_tree_model_adapter.cpp @@ -120,7 +120,9 @@ void SYMBOL_TREE_MODEL_ADAPTER::AddLibraries( SCH_BASE_FRAME* aFrame ) for( const wxString& lib : toLoad ) { - if( !m_adapter->GetLibraryStatus( lib ) ) + std::optional status = m_adapter->GetLibraryStatus( lib ); + + if( !status || status->load_status != LOAD_STATUS::LOADED ) { m_pending_load_libraries.insert( lib ); continue;