Library Editor: fixed an assert after removing libraries with Symbol Library Table dialog

This commit is contained in:
Maciej Suminski 2017-11-22 14:15:51 +01:00
parent d76f7d7bd2
commit 6b74f8ef48
2 changed files with 8 additions and 2 deletions

View File

@ -253,6 +253,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_canvas->SetEnableBlockCommands( true );
m_libMgr = new LIB_MANAGER( *this );
SyncLibraries();
m_treePane = new CMP_TREE_PANE( this, m_libMgr );
ReCreateMenuBar();
@ -485,7 +486,6 @@ void LIB_EDIT_FRAME::OnEditSymbolLibTable( wxCommandEvent& aEvent )
{
SCH_BASE_FRAME::OnEditSymbolLibTable( aEvent );
SyncLibraries();
m_treePane->Refresh();
}
@ -1616,14 +1616,21 @@ wxString LIB_EDIT_FRAME::getTargetLib() const
void LIB_EDIT_FRAME::SyncLibraries()
{
auto tree = m_treePane ? m_treePane->GetCmpTree() : nullptr;
wxBusyCursor cursor;
if( tree )
tree->Freeze();
wxProgressDialog progressDlg( _( "Loading symbol libraries" ),
wxEmptyString, m_libMgr->GetAdapter()->GetLibrariesCount(), this );
m_libMgr->Sync( true, [&]( int progress, int max, const wxString& libName ) {
progressDlg.Update( progress, wxString::Format( _( "Loading library '%s'" ), libName ) );
} );
if( tree )
tree->Thaw();
}

View File

@ -38,7 +38,6 @@ CMP_TREE_PANE::CMP_TREE_PANE( LIB_EDIT_FRAME* aParent, LIB_MANAGER* aLibMgr )
// Create widgets
wxBoxSizer* boxSizer = new wxBoxSizer( wxVERTICAL );
m_libEditFrame->SyncLibraries();
m_tree = new COMPONENT_TREE( this, &SYMBOL_LIB_TABLE::GetGlobalLibTable(),
m_libMgr->GetAdapter(), COMPONENT_TREE::SEARCH );