Passing a string to LIBRARY_TABLE's c'tor doesn't do what you think it does.

Also fixes nested tables being deleted out from under
the dialog.

Also fixes a bug where PANEL_DESIGN_BLOCK_LIB_TABLE
had fallen behind the the other two.
This commit is contained in:
Jeff Young
2026-01-20 13:18:46 +00:00
parent a8fcc466cd
commit f4e025596b
12 changed files with 47 additions and 33 deletions
@@ -245,10 +245,10 @@ protected:
void openTable( const LIBRARY_TABLE_ROW& aRow ) override
{
wxString uri = LIBRARY_MANAGER::ExpandURI( aRow.URI(), Pgm().GetSettingsManager().Prj() );
auto nestedTable = std::make_unique<LIBRARY_TABLE>( uri, LIBRARY_TABLE_SCOPE::GLOBAL );
wxFileName fn( LIBRARY_MANAGER::ExpandURI( aRow.URI(), Pgm().GetSettingsManager().Prj() ) );
std::shared_ptr<LIBRARY_TABLE> child = std::make_shared<LIBRARY_TABLE>( fn, LIBRARY_TABLE_SCOPE::GLOBAL );
m_panel->AddTable( nestedTable.get(), aRow.Nickname(), true );
m_panel->OpenTable( child, aRow.Nickname() );
}
wxString getTablePreamble() override
@@ -261,7 +261,7 @@ protected:
};
void PANEL_DESIGN_BLOCK_LIB_TABLE::OpenTable( LIBRARY_TABLE* aTable, const wxString& aTitle )
void PANEL_DESIGN_BLOCK_LIB_TABLE::OpenTable( const std::shared_ptr<LIBRARY_TABLE>& aTable, const wxString& aTitle )
{
for( int ii = 2; ii < (int) m_notebook->GetPageCount(); ++ii )
{
@@ -276,7 +276,8 @@ void PANEL_DESIGN_BLOCK_LIB_TABLE::OpenTable( LIBRARY_TABLE* aTable, const wxStr
}
}
AddTable( aTable, aTitle, true );
m_nestedTables.push_back( aTable );
AddTable( aTable.get(), aTitle, true );
// Something is pretty fishy with wxAuiNotebook::ChangeSelection(); on Mac at least it
// results in a re-entrant call where the second call is one page behind.