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
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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<LIB_STATUS> status = m_adapter->GetLibraryStatus( lib );
|
||||
|
||||
if( !status || status->load_status != LOAD_STATUS::LOADED )
|
||||
{
|
||||
m_pending_load_libraries.insert( lib );
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user