eeschema: Use recursive mutex for SCH_PIN

We need to be able to lock individual actions while keeping the code
modular.  The recursive mutex keeps this thread-local.

Fixes https://gitlab.com/kicad/code/kicad/issues/5186
This commit is contained in:
Seth Hillbrand 2020-08-14 18:41:11 -07:00
parent b8b3d5c16d
commit 275e810573
2 changed files with 3 additions and 3 deletions

View File

@ -100,7 +100,7 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
void SCH_PIN::ClearDefaultNetName( const SCH_SHEET_PATH* aPath ) void SCH_PIN::ClearDefaultNetName( const SCH_SHEET_PATH* aPath )
{ {
std::lock_guard<std::mutex> lock( m_netmap_mutex ); std::lock_guard<std::recursive_mutex> lock( m_netmap_mutex );
if( aPath ) if( aPath )
m_net_name_map.erase( *aPath ); m_net_name_map.erase( *aPath );
@ -114,7 +114,7 @@ wxString SCH_PIN::GetDefaultNetName( const SCH_SHEET_PATH aPath )
if( m_libPin->IsPowerConnection() ) if( m_libPin->IsPowerConnection() )
return m_libPin->GetName(); return m_libPin->GetName();
std::lock_guard<std::mutex> lock( m_netmap_mutex ); std::lock_guard<std::recursive_mutex> lock( m_netmap_mutex );
if( m_net_name_map.count( aPath ) > 0 ) if( m_net_name_map.count( aPath ) > 0 )
return m_net_name_map.at( aPath ); return m_net_name_map.at( aPath );

View File

@ -40,7 +40,7 @@ class SCH_PIN : public SCH_ITEM
bool m_isDangling; bool m_isDangling;
/// The name that this pin connection will drive onto a net /// The name that this pin connection will drive onto a net
std::mutex m_netmap_mutex; std::recursive_mutex m_netmap_mutex;
std::map<const SCH_SHEET_PATH, wxString> m_net_name_map; std::map<const SCH_SHEET_PATH, wxString> m_net_name_map;
public: public: