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:
parent
09c5b9df1d
commit
639f59839e
|
@ -24,6 +24,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <wx/debug.h>
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
@ -197,8 +198,17 @@ LIB_TABLE_ROW* LIB_TABLE::findRow( const wxString& aNickName, bool aCheckIfEnabl
|
||||||
LIB_TABLE* cur = (LIB_TABLE*) this;
|
LIB_TABLE* cur = (LIB_TABLE*) this;
|
||||||
|
|
||||||
do
|
do
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
std::shared_lock<std::shared_mutex> lock( cur->m_mutex );
|
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 ) )
|
if( cur->m_rowsMap.count( aNickName ) )
|
||||||
row = &*cur->m_rowsMap.at( aNickName );
|
row = &*cur->m_rowsMap.at( aNickName );
|
||||||
|
|
|
@ -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
|
// instantiate a PLUGIN of the proper kind if it is not already in this
|
||||||
// SYMBOL_LIB_TABLE_ROW.
|
// SYMBOL_LIB_TABLE_ROW.
|
||||||
if( !row->plugin )
|
if( !row->plugin )
|
||||||
{
|
|
||||||
row->setPlugin( SCH_IO_MGR::FindPlugin( row->type ) );
|
row->setPlugin( SCH_IO_MGR::FindPlugin( row->type ) );
|
||||||
|
|
||||||
row->plugin->SetLibTable( this );
|
row->plugin->SetLibTable( this );
|
||||||
}
|
|
||||||
|
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue