Use a scoped_lock earlier in RemoveAdapter as checking m_adapters for a key runs into a theoretical conflict with RegisterAdapter touching it.
Silences coverity warning.
This commit is contained in:
@@ -509,13 +509,13 @@ void LIBRARY_MANAGER::RegisterAdapter( LIBRARY_TABLE_TYPE aType,
|
||||
|
||||
bool LIBRARY_MANAGER::RemoveAdapter( LIBRARY_TABLE_TYPE aType, LIBRARY_MANAGER_ADAPTER* aAdapter )
|
||||
{
|
||||
std::scoped_lock lock( m_adaptersMutex );
|
||||
if( !m_adapters.contains( aType ) )
|
||||
return false;
|
||||
|
||||
if( m_adapters[aType].get() != aAdapter )
|
||||
return false;
|
||||
|
||||
std::scoped_lock lock( m_adaptersMutex );
|
||||
m_adapters.erase( aType );
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user