From 275e810573a985384cec18a50dc1489a93c8d6fc Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 14 Aug 2020 18:41:11 -0700 Subject: [PATCH] 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 --- eeschema/sch_pin.cpp | 4 ++-- eeschema/sch_pin.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eeschema/sch_pin.cpp b/eeschema/sch_pin.cpp index 9802372493..8e3484a3a9 100644 --- a/eeschema/sch_pin.cpp +++ b/eeschema/sch_pin.cpp @@ -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 ) { - std::lock_guard lock( m_netmap_mutex ); + std::lock_guard lock( m_netmap_mutex ); if( aPath ) m_net_name_map.erase( *aPath ); @@ -114,7 +114,7 @@ wxString SCH_PIN::GetDefaultNetName( const SCH_SHEET_PATH aPath ) if( m_libPin->IsPowerConnection() ) return m_libPin->GetName(); - std::lock_guard lock( m_netmap_mutex ); + std::lock_guard lock( m_netmap_mutex ); if( m_net_name_map.count( aPath ) > 0 ) return m_net_name_map.at( aPath ); diff --git a/eeschema/sch_pin.h b/eeschema/sch_pin.h index 90c0cb71e9..d80d4f8324 100644 --- a/eeschema/sch_pin.h +++ b/eeschema/sch_pin.h @@ -40,7 +40,7 @@ class SCH_PIN : public SCH_ITEM bool m_isDangling; /// The name that this pin connection will drive onto a net - std::mutex m_netmap_mutex; + std::recursive_mutex m_netmap_mutex; std::map m_net_name_map; public: