Browse Source

Remove a few more crashers

Need to check SYM_LIB_TABLE_ENTRY for null but need to check
FP_LIB_TABLE_ENTRY for throwing
pcb_db
Seth Hillbrand 9 months ago
parent
commit
112e8e7ccb
  1. 4
      eeschema/widgets/panel_symbol_chooser.cpp
  2. 11
      pcbnew/footprint_libraries_utils.cpp
  3. 18
      pcbnew/fp_tree_synchronizing_adapter.cpp

4
eeschema/widgets/panel_symbol_chooser.cpp

@ -99,7 +99,9 @@ PANEL_SYMBOL_CHOOSER::PANEL_SYMBOL_CHOOSER( SCH_BASE_FRAME* aFrame, wxWindow* aP
bool pinned = alg::contains( session.pinned_symbol_libs, nickname )
|| alg::contains( project.m_PinnedSymbolLibs, nickname );
if( libs->FindRow( nickname )->GetIsVisible() )
SYMBOL_LIB_TABLE_ROW* row = libs->FindRow( nickname );
if( row && row->GetIsVisible() )
adapter->AddLibrary( nickname, pinned );
}
}

11
pcbnew/footprint_libraries_utils.cpp

@ -527,10 +527,19 @@ bool FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary( const LIB_ID& aFPID, bool
wxString nickname = aFPID.GetLibNickname();
wxString fpname = aFPID.GetLibItemName();
wxString libfullname;
// Legacy libraries are readable, but modifying legacy format is not allowed
// So prompt the user if he try to delete a footprint from a legacy lib
wxString libfullname = PROJECT_PCB::PcbFootprintLibs( &Prj() )->FindRow( nickname )->GetFullURI();
try
{
libfullname = PROJECT_PCB::PcbFootprintLibs( &Prj() )->FindRow( nickname )->GetFullURI();
}
catch( ... )
{
// If we can't find the nickname, stop here
return false;
}
if( PCB_IO_MGR::GuessPluginTypeFromLibPath( libfullname ) == PCB_IO_MGR::LEGACY )
{

18
pcbnew/fp_tree_synchronizing_adapter.cpp

@ -79,16 +79,26 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::Sync( FP_LIB_TABLE* aLibs )
{
const wxString& name = it->get()->m_Name;
// Remove the library if it no longer exists or it exists in both the global and the
// project library but the project library entry is disabled.
if( !m_libs->HasLibrary( name, true )
try
{
// Remove the library if it no longer exists or it exists in both the global and the
// project library but the project library entry is disabled.
if( !m_libs->HasLibrary( name, true )
|| m_libs->FindRow( name, true ) != m_libs->FindRow( name, false ) )
{
it = deleteLibrary( it );
continue;
}
updateLibrary( *(LIB_TREE_NODE_LIBRARY*) it->get() );
}
catch( ... )
{
// If the library isn't found, remove it
it = deleteLibrary( it );
continue;
}
updateLibrary( *(LIB_TREE_NODE_LIBRARY*) it->get() );
++it;
}

Loading…
Cancel
Save