Make sure database library has updated pointer to library table

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17903


(cherry picked from commit 1a76fce255)

Co-authored-by: Jon Evans <jon@craftyjon.com>
This commit is contained in:
Jon Evans 2024-05-03 15:39:33 +00:00
parent 09c5b9df1d
commit 639f59839e
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

@ -368,10 +368,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;
}