Make sure database library has updated pointer to library table

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17903
This commit is contained in:
Jon Evans 2024-05-03 09:52:00 -04:00
parent ee75a50d84
commit 1a76fce255
2 changed files with 13 additions and 4 deletions

View File

@ -24,6 +24,7 @@
*/
#include <wx/debug.h>
#include <wx/filename.h>
#include <set>
#include <common.h>
@ -198,7 +199,16 @@ LIB_TABLE_ROW* LIB_TABLE::findRow( const wxString& aNickName, bool aCheckIfEnabl
do
{
std::shared_lock<std::shared_mutex> lock( cur->m_mutex );
try
{
std::shared_lock<std::shared_mutex> lock( cur->m_mutex );
}
catch( std::system_error& e )
{
wxASSERT_MSG( false, wxString::Format( wxS( "Failed to lock lib table mutex: %s" ),
e.what() ) );
continue;
}
if( cur->m_rowsMap.count( aNickName ) )
row = &*cur->m_rowsMap.at( aNickName );

View File

@ -359,10 +359,9 @@ SYMBOL_LIB_TABLE_ROW* SYMBOL_LIB_TABLE::FindRow( const wxString& aNickname, bool
// instantiate a PLUGIN of the proper kind if it is not already in this
// SYMBOL_LIB_TABLE_ROW.
if( !row->plugin )
{
row->setPlugin( SCH_IO_MGR::FindPlugin( row->type ) );
row->plugin->SetLibTable( this );
}
row->plugin->SetLibTable( this );
return row;
}