Don't deadlock when adding rows.

This commit is contained in:
Jeff Young
2024-07-23 17:49:34 +01:00
parent 51792fc5ea
commit 431087fc7c
4 changed files with 33 additions and 16 deletions
+10 -1
View File
@@ -309,6 +309,15 @@ bool LIB_TABLE::InsertRow( LIB_TABLE_ROW* aRow, bool doReplace )
{
std::lock_guard<std::shared_mutex> lock( m_mutex );
doInsertRow( aRow, doReplace );
reindex();
return true;
}
bool LIB_TABLE::doInsertRow( LIB_TABLE_ROW* aRow, bool doReplace )
{
auto it = m_rowsMap.find( aRow->GetNickName() );
if( it != m_rowsMap.end() )
@@ -452,7 +461,7 @@ bool LIB_TABLE::migrate()
void LIB_TABLE::Load( const wxString& aFileName )
{
std::shared_lock<std::shared_mutex> lock( m_mutex );
std::lock_guard<std::shared_mutex> lock( m_mutex );
clear();
// It's OK if footprint library tables are missing.